|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|||
|
Parsing Strings
I currently have some text in a multiline textbox, how can the the following code be adapted to parse characters 3 to 8 on line 1 of the textbox. Then characters 2 to 6 on line to of the text box, and store both extracted strings in two separate variables.
The following code extracts from line 1 then store the extracted string inside sMidText Many Thanks, Last edited by Nilpo : February 8th, 2007 at 01:18 AM. |
|
|||||
|
Basically, you use the Split function to separate your string at newline characters. This results in an array containing one substring for each line. You finish up by parsing each line for the requested characters with the Mid function.
vb Code:
__________________
Scripting problems? Windows questions? Ask the Windows Guru! Stay up to date with all of my latest content. Follow me on Twitter! Help us help you! Post your exact error message with these easy tips! Last edited by Nilpo : February 8th, 2007 at 12:47 AM. |
|
|||
|
Quote:
Many Thanks, |
|
|||
|
I currently have the following information a text box:
Date: 12/12/06 Name: Bill Age: 19 How can the data after each field be extracted, and store in a text file. To result in the text file containing only (12/12/06, Bill, 19 etc) The data after the fields changes i.e. (12/12/06, Bill, 19 etc). |
|
||||
|
Quote:
|
|
|||
|
Quote:
Many Thanks, much appreciated |
|
|||||
|
Well, if you don't need to preserve the existing lines, this can be done a lot easier like this:
(I'm assuming that the beginning of the email could have multiple lines, so I'm counting backwards. This assumes that the 3 fields we want are always listed LAST) vb Code:
Last edited by Nilpo : February 8th, 2007 at 12:49 AM. |
|
|||
|
Quote:
Many Thanks, much appreciated! |
|
|||
|
What is CSV?
Is there anyway of making the file unreadable, via storing the data as binary etc. Many Thanks, much appreciated! |
|
|||
|
Is there anyway you could comment you code, in order for me to work out how it all works, and what values are going in to where?
Many Thanks, |
|
|||
|
Quote:
Date: 12/12/06 Name: Bill Age: 19 the date, name, and age returned is as follows: : 12/12/06 Bill 19 is there anyway of extracting the date, with ": " before it? Many Thanks, much appreciated! |
|
|||
|
Oh yeah, i forgot to mention, the information currently in the textbox is actually the following, including line breaks:
<Name Field> has sent the following information: Date: 12/12/06 Name: Bill Age: 19 What needs to be changed in the code now to ignore <Name Field> has sent the following information: and the two line breaks? Sorry, Many Thanks, much appreciated!!!! :-) Last edited by Salchester : January 2nd, 2007 at 08:53 PM. |
![]() |
| Viewing: Dev Hardware Forums > SOFTWARE > Programming > Parsing Strings |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|