foldstring logic