|
-
Feb 1st, 2000, 01:34 PM
#1
Thread Starter
Lively Member
Hi,
I'm much of a newbie when it comes to vb string parsing. Can some tell me how can I extract a certain number of characters from a string and store the remaining string somewhere else?
What functions do I use?
Thanks.
-
Feb 1st, 2000, 04:29 PM
#2
Fanatic Member
Use the Mid Function!
Eg
dim MainStr as string
dim NewString as string
MainStr = "Hi, This is a string!"
NewString = mid(MainStr, 5,3) 'returns 3 chrs from position 4
'NewString now = "thi"
******************************
If you want only the piece you didn't copy then you'll have to use left() and right() to grab the parts:
NewString = left(MainStr,4) & right(MainStr,(len(MainStr) - 4 - 3) 'assuming you don't know the length of the MainStr, other wise you can skip the len(MainStr) bit and just specify the right portion
NewString = "Hi, s is a string"
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
|