|
-
Aug 7th, 2000, 05:59 PM
#1
Thread Starter
Junior Member
Is there a resource for looking at examples of advanced string manipulations? I am looking for topics such as splitting strings, regular expression matching, splitting a string into an array, looping though an array where the size is unknown, and reading a string characterby character.
I am still getting adjsuted to VB and using the MSDN cd as a reference but a lot of the runctions I have found look extremely inefficient without saving much code writing.
----
http://www.learntogo.f.net
-
Aug 7th, 2000, 06:12 PM
#2
To split strings into an array, use the Split() function:
Code:
MyString = "One,Two,Three,Four"
MyStringArray = Split(MyString, ",")
For I = 0 To UBound(MyStringArray)
Print MyStringArray(I)
Next I
To read a string character by character, use the Mid() function:
Code:
MyString = "One,Two"
For I = 1 To Len(MyString)
tChar = Array(Mid(MyString, I, 1))
Print tChar(I)
Next I
To match, use the Like operator:
Code:
MyString = "Onetwothree"
If MyString Like "*two*" Then
Print "String is found"
Else
Print "String is not found"
End If
-
Aug 7th, 2000, 06:32 PM
#3
Thread Starter
Junior Member
//------------------
MyString = "One,Two"
For I = 1 To Len(MyString)
tChar = Array(Mid(MyString, I, 1))
Print tChar(I)
Next I
//-----------------
Why the use of Array() ? It appears to be not needed by my MSDN CD difinition.
Thanks
jon
----
http://www.learntogo.f.net
-
Aug 7th, 2000, 06:36 PM
#4
Sorry, that was a mistake. To make it work properly, omit the Array function from the statement.
Code:
MyString = "One,Two"
For I = 1 To Len(MyString)
tChar = Mid(MyString, I, 1)
Print tChar(I)
Next I
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
|