Results 1 to 4 of 4

Thread: Advanced String Manupulation / Function ??

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    16
    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

  2. #2
    Guest
    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

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    16
    //------------------
    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

  4. #4
    Guest
    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
  •  



Click Here to Expand Forum to Full Width