Results 1 to 4 of 4

Thread: Selecting characters

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 1999
    Posts
    9

    Post

    If i have a string of text named Zstring, and it currently holds the text:
    "Dogs are big"
    If I want it to read, for example, the 4th character in the string, which in this case is "s", how do I find that out.

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,427

    Post

    Look up the Mid function.

    ------------------
    Marty
    Can you buy an entire chess set in a pawn shop?

  3. #3
    Guest

    Post

    you can use the mid function.
    to get the fourth letter i believe you would do in this format mid(stringname, startingpoint, length to take)
    so you would do Mid(StrName, 4, 1) that will get you the fourth letter.
    if you do Mid(StrName, x, 1) it in a for loop from 1 to string length for the x you will go through each letter.

  4. #4
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    If you want to actually select it (highlight)
    do this:
    Code:
    Text1.SelStart = 1
    Text1.SelLength = 3
    Where if using Mid you'ld:
    Code:
    Mid$(Str$,SelStart,SelLength)
    The first selects it like selecting and highlighting with the mouse.
    The second sets it to a varible without highlighting or you could do both.

    ------------------
    DiGiTaIErRoR

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