23 c#
我所拥有的是一个巨大的文本文件,其中包含一堆被拆分的字符串\.对我来说问题是可以有5 \或4 \或3 \.
\无论有多少人,我需要把它拉到最后.任何帮助表示赞赏.
例子:
I\need\this I\want\line\this Hello\give\me\all\this
我需要这个词this,但显然这不仅仅是单词this.
Mat*_*ott 53
string last = inputString.Substring(inputString.LastIndexOf('\\') + 1);
Run Code Online (Sandbox Code Playgroud)
Ant*_*ram 18
string myString = inputString.Split('\\').Last();
Run Code Online (Sandbox Code Playgroud)
差点忘了这个(尽管有点厚脸皮):
string result = Path.GetFilename(input);