String manipulation

gnappi

Newcomer
Joined
Mar 7, 2006
Messages
13
I have a variable length string that I need to manipulate.

It's 20+ characters long, but I only need the first 3 and second three for
example:

abcdef 12.5,.76m4---L7,8724...

I can get the strip out all but first three (ABC) , and shift them to upper case, but can't find a method to extract the second three or the characters def.

Here's my code:

str1 = (str1.ToUpper)
trimmedString = (str1.Remove(3))

Any ideas?



Thanks,

Gary
 
I'm not entirely sure I've understood what your trying to achieve. Assuming I've understood you at least partially correctly the Method you would need is the SubString() method.
Visual Basic:
Dim str As String = "abc123alskdfjlasdkfj;kl"
Dim fstThree As String = str.Substring(0, 3)
' fstThree would be abc
Dim secThree As String = str.Substring(3, 3)
' secThree would be 123
 
Back
Top