Use a regex:
private static Regex regex = new Regex(
"^(?<Host>.*@.*?)/(?<Path>.*)$",
RegexOptions.IgnoreCase
| RegexOptions.CultureInvariant
| RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
This spilts your string into two groups: Host and Path. - you want the Path only.
"thank you OriginalGriff, But how to use it :("
string s = "ftp://me@localhost/newfolder/newfolder1/";
Match m = splitFTP.Match(s);
if (m.Success)
{
Console.WriteLine(m.Groups["Host"].Value);
Console.WriteLine(m.Groups["Path"].Value);
}
...
private static Regex splitFTP = new Regex("^(?<Host>.*@.*?)/(?<Path>.*)$",
RegexOptions.IgnoreCase
| RegexOptions.CultureInvariant
| RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled);
Will print:
ftp://me@localhost
newfolder/newfolder1/