使用Visual Studio 2005从字段中提取信息

时间:2013-08-20 20:52:10

标签: visual-studio-2005

我需要使用Visual Studio 2005从字段中提取特定信息。我只需要' partNumber'和' serialNumber'来自这个领域;

  

请将BeginGroup:databasecurrentFifos = 0maximumFifos = 34369maximumSpace = 6291456percentUsed = 7totalFixedSpace = 123156totalIndexSpace = 77182totalRowCount = 2533totalRowSpace = 139024totalTableSpace = 339362uncollectedFifos = 0usedSpace = 478386EndGroup:databaseBeginGroup:networkDNS_ServerIP = NoneDNS_DomainName = NoneFTP_Enabled = falseEndGroup:networkBeginGroup:hardwareBeginGroup:biometricsEndGroup:biometricsBeginGroup:mSystemformat = 7101processorType = 859chipId = CFEndGroup:mSystemBeginGroup:barcodesBarcode_attached = noSymbologies = code3of9   i2of5   code128Remote_Barcode_attached = noEndGroup:barcodesBeginGroup:boardrevision = REV   厌恶= 415partNumber = 8602800-503serialNumber = JC117590EndGroup:boardBeginGroup:magneticstrackNum = noEndGroup:magneticsBeginGroup:memorySDRAM = 134217728BeginGroup:flashDisksflashDisk0 = 1018773504flashDisk1 = 0numOfFlashDisks = 1EndGroup:flashDisksEndGroup:memoryBeginGroup:peripheralsmodem = noneWand_attached = noEndGroup:peripheralsBeginGroup:keypadKeypad_Type = NumericEndGroup:keypadBeginGroup:proximityReadersProximityReader_attached = noProxReaderFormat1 =默认   26位   FormatProximityReader_NumRecords = 2RemoteProx_attached = noRemoteProxFormat1 =默认   26位   FormatRemoteProx_NumRecords = 2EndGroup:proximityReadersEndGroup:hardwareBeginGroup:softwarerelease = 03.00.07.006

     HTMLClientVersion = 5708model =克罗诺斯-4500OSversion = 5708bootVersion = 5708appVersion = 5708dbSchema = 5708Font_Information =默认   拉丁字体。端基:软件

1 个答案:

答案 0 :(得分:0)

这个答案假设使用了VB.NET,并且还假设源字符串的结构没有改变。

'Variable to hold source data
Dim sSource As String 

'*** perform code here to load source (from DB etc.) ***

'separator array (change this as needed if sructure of the source sting changes)
Dim sSep As String() = {"partNumber=", "serialNumber=", "EndGroup:boardBeginGroup:magnetic"}

'split the source into Array
Dim asSplit As String() = sSource.Split(sSep, StringSplitOptions.None)

'get Part Number
Dim sPartNumber As String = asSplit(1)

'get Serial Number
Dim sSerialNumber As String = asSplit(2)