使用vb.net帮助获取字符串的一部分 [英] help getting parts of a string with vb.net
本文介绍了使用vb.net帮助获取字符串的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用这些机器名称,它们的位置在3456个字母(我们的10或12个字母)中.我一直在Google搜索如何拆分字符串,但还没有找到我正在寻找的方法来实现此功能.
机器名称看起来像是DDXXXX000000,现在我需要获取XXXX值.帮助将非常有用,或者有人可以将我指出正确的方向.
I have these machine names at work that has its location in the 3456 letter our of 10 or 12 letters. I have been searching google for how to split a string but havent found what im looking for to make this work.
the machine names look like this DDXXXX000000 now i need to get the XXXX value. help would be great or if someone can point me in the right direction that would be great.
推荐答案
System.String.Split
或System.String.Substring
有什么问题?你看到了吗
http://msdn.microsoft.com/en-us/library/system.string.aspx [ ^ ]?
—SA
What''s wrong withSystem.String.Split
orSystem.String.Substring
? Did you see
http://msdn.microsoft.com/en-us/library/system.string.aspx[^]?
—SA
使用string
类的Substring
方法来获取所需的子字符串,如下所示
UseSubstring
method ofstring
class to get the required sub string as shown below
Sub Main
Dim MachineName as string = "DDXXXX000000"
Dim Location as String = MachineName.Substring(2,4)
Console.WriteLine(Location)
End Sub
这篇关于使用vb.net帮助获取字符串的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文