Results 1 to 6 of 6

Thread: Left function

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    US
    Posts
    20

    Post

    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 firt two numbers but how can I "cut" the numbers out of the string?

    Andy

  2. #2
    Guest

    Post

    geez, thanks. I 'assumed' AndyC had a brain, my mistake.

  3. #3
    Hyperactive Member
    Join Date
    Sep 1999
    Location
    Leeds, UK
    Posts
    287

    Post

    Could somebody please tell me how to use the Trim$(string)? I used this code to remove all the spaces but it did not work:

    Trim(strString)

    Whats wrong with that?

    Thanks

  4. #4
    Guest

    Post

    it trims the all of the spaces before and after a string but not within the string. If you want to replace all of the spaces in a string try:

    somevariable = replace("your string",Chr(32),"")

    that removes all of the spaces in your string

    [This message has been edited by pvb (edited 01-15-2000).]

  5. #5
    Guest

    Post

    use mid(string, start, length)

  6. #6
    Guest

    Post

    seeing as pvb didn't bother explaining it, this is how you use the MID function...

    if you want the third number (13) do this:
    Code:
    MyNumber = mid(YourString, 7, 2)
    "MyNumber" now contains the string "13", 7 in the brackets is the starting point of the desired string and "13" is 2 characters long, hence the 2 in the brackets.

    if you want to convert this "13" into a number instead of a string, then use...

    val(mid(YourString, 7, 2))

    instead.

    ------------------

    Wossname,
    Email me: wossnamex@talk21.com


    [This message has been edited by wossname (edited 01-15-2000).]

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