vb.net:在字符串中查找字符串的位置?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1639381/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
vb.net: finding a position of a string within a string?
提问by l--''''''---------''''''''''''
is instr used in vb.net for this?
vb.net 中为此使用了 instr 吗?
回答by VinPepe
Use String.IndexOf
使用 String.IndexOf
http://msdn.microsoft.com/en-us/library/system.string.indexof.aspx
http://msdn.microsoft.com/en-us/library/system.string.indexof.aspx
回答by Meta-Knight
You can use the IndexOfmethod on a string, and you can also use the VB InStrfunction if you wish, although I would suggest sticking to .NET specific functions.
您可以对字符串使用IndexOf方法,如果您愿意,也可以使用 VB InStr函数,尽管我建议坚持使用 .NET 特定函数。
I would also suggest that you take a look at the documentation of the String methodswhich will help you know what functionality is available in the framework when working with strings. You can also take a look at the documentation for VB-specific string functions.
我还建议您查看String 方法的文档,这将帮助您了解在处理字符串时框架中可用的功能。您还可以查看VB 特定字符串函数的文档。