PDA

Click to See Complete Forum and Search --> : Left function


AndyC
Jan 14th, 2000, 09:54 PM
In my program I have strings like " 49 49 13 49 23 49" without the quotes and I use Trim to take away spaces then Left to take the first two numbers but how can I "cut" the numbers out of the string?

Andy

chrisjk
Jan 14th, 2000, 10:57 PM
try using

MyString = Right(MyString, Len(MyString) - 2)

This works my taking the original MyString minus 2 characters and placing it back in MyString. There is probably a "better" way of doing it, but it works fine for me.

Regards,

------------------
- Chris
chris.kilhams@btinternet.com
If it ain't broke - don't fix it :)

Clunietp
Jan 15th, 2000, 11:27 AM
you can extract the numbers into an array using the VB6 split function:

Dim strTemp As String
Dim strArray() As String
Dim I As Integer

strTemp = " 49 49 13 49 23 49"

strArray() = Split(strTemp, " ")

For I = LBound(strArray) To UBound(strArray)
Debug.Print strArray(I)
Next I

XxEvilxX
Jan 15th, 2000, 11:32 AM
or you can do this

Dim I
Dim H

H + Text1.text
I = Mid(H,1,1)

Text2.text = I