-
Jul 5th, 2012, 08:28 AM
#1
Thread Starter
New Member
How to manipulate this string
Hi all,
I need to be able to take substrings of the below string that is entered into a textbox in VB6. The string is an address and I need to take a substring of the City, State, Street, Zip Code, and Country
400 Main Street
East Manchester, TX 12345
So I basically need the substrings like this:
Street= 400 Main Street
City = East Manchester
State = TX
Zip = 12345
Your help is greatly appreciated...
Last edited by Mr_Bateman; Jul 5th, 2012 at 08:29 AM.
Reason: Forgot a detail
-
Jul 5th, 2012, 09:18 AM
#2
Re: How to manipulate this string
There is no good way to do this. But if you are sure that the data will always be in this format, then here is the basic algorithm to follow.
1. Replace CRLF with comma.
2. Split on comma.
3. First part of the splitted string is Street, second is City.
4. Split the third part on space.
5. The first part of this splitted string is your State and second part is the Zip.
You can use the Split function and Replace function to do this job.
-
Jul 5th, 2012, 10:34 AM
#3
Re: How to manipulate this string
If this is really VB6, then it is in the wrong forum, though what Pradeep suggested holds true for any language.
My usual boring signature: Nothing
Tags for this Thread
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
|