|
-
Jul 14th, 2005, 12:06 PM
#1
help parsing a string
I have this text file that I need to parse the number the is bolded
Code:
File creation date: 9/14/2005
File creation time: 8:57:33 AM
Product: MyApp
Version: 1.0.2083.13856
Build Date: 9/14/2005 8:46:05 AM
IP Address:
XXX.XXX.X.XXX
System Information:
Computer Name = KEVIN-LT
Computer Manufacturer = Hewlett-Packard
Computer Model = Pavilion zv5000 (PL976UA#ABA)
OS Name = Microsoft Windows XP Professional|C:\WINDOWS|\Device\Harddisk0\Partition1
OS Version = 5.1.2600
System Type = X86-based PC
Total Physical Memory = 401584128
Windows Directory = C:\WINDOWS
Drive Information
C:\ Volume Number: -666002322
D:\ Volume Number: -1062776663
E:\ Volume Number: -265637814
G:\ Volume Number: -265637814
J:\ Volume Number: -1070353568
Current number of systems: 1
the file will always have "C:\ Volume Number:" appearing only once right before the number I need. Can I split a string based on another string? or what functions can I use that will lead to an efficient way to do this? I don't need the code I can write that if I know the best functions to use to get the job done.
thanks
kevin
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
-
Jul 14th, 2005, 12:12 PM
#2
Re: help parsing a string
Probably Regular Expressions will be the best. I have only used it twice and it seems to be very flexiable in what it can do.
Is your app outputting the file?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 14th, 2005, 01:12 PM
#3
Re: help parsing a string
 Originally Posted by RobDog888
Probably Regular Expressions will be the best. I have only used it twice and it seems to be very flexiable in what it can do.
Is your app outputting the file?
Yeah it is, then another app I'm writting parses it.
I'll look at regular expression and see how to use it (them)
thanks
kevin
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
-
Jul 14th, 2005, 01:14 PM
#4
Re: help parsing a string
since your app writes the file then wouldnt it be easier to write it out in a easier format for you to read in? or maybe another file
for parsing only and not the user?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 14th, 2005, 01:22 PM
#5
Re: help parsing a string
yeah it would be, but the format is already in use by others and would be a terrible pain to change everything else. You know, it's the boring details...it always comes down to details.
kevin
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
-
Jul 14th, 2005, 01:26 PM
#6
Re: help parsing a string
I thought about that too, but if you were to write out a duplicate file customized to your parsing needs then that will possibly
save you some headaches.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 14th, 2005, 02:00 PM
#7
Re: help parsing a string
 Originally Posted by RobDog888
I thought about that too, but if you were to write out a duplicate file customized to your parsing needs then that will possibly
save you some headaches. 
unfortunatley that create other headaches
I have it working using instr like this (with a small output file mod)
VB Code:
's= OutputFile.txt
Const rConst As String = "C:\ Volume Number:"
Dim iStart As Integer = InStr(s, rConst)
istart += rConst.Length
Dim iEnd As Integer = s.IndexOf(vbCrLf, iStart)
Dim myNum As String = s.Substring(iStart, iEnd - iStart).Trim
but I would rather use a RegEx but this doesn't work
VB Code:
Const rConst As String = "C:\ Volume Number:"
Dim r As New System.Text.RegularExpressions.Regex(rConst)
Dim iStart As Integer = r.Match(s).Index
iStart is always 0. How come? I suspect I'm not using RegEX correctly
thanks
for the help Rob
kevin
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
-
Jul 14th, 2005, 02:22 PM
#8
Re: help parsing a string
There are codes that make up your search string. It looks like 1337. 
Look here, I think this will here for the expression needed.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|