开发者

How do I locate the last occurrence of string in a string?

Is there a function which would search for the last occurrence of a certain substring and return the index of it?

For example, if I want to search for the last occurrenc开发者_如何学JAVAe of the char '\' in a file path 'C:\Program Files\Microsoft'.


string.LastIndexOf


You look for

 "somesthing".LastIndexOf("char/string");


You can use: string.LastIndexOf(String)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜