0

我需要使用 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 Aversion=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=Default 26 Bit FormatProximityReader_NumRecords=2RemoteProx_attached=noRemoteProxFormat1=Default 26 Bit FormatRemoteProx_NumRecords=2EndGroup:proximityReadersEndGroup:hardwareBeginGroup:softwarerelease=03.00.07.006

HTMLClientVersion=5708model=Kronos-4500OSversion=5708bootVersion=5708appVersion=5708dbSchema=5708Font_Information=默认拉丁字体。结束组:软件
4

1 回答 1

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)
于 2013-08-20T21:57:32.727 回答