[String] add toNamespace method

toNamespace method converts path to namespace
corrections related to the use toNamespace method