Results 1 to 5 of 5

Thread: Simple string manipulation...

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    323
    How do I specify I only want the 1st character of a string?

    Code:
    strArt = "Art"
    I want to get just the "A". How do I do that?

    Thanks.
    If you think education is expensive, try ignorance.

  2. #2
    Addicted Member
    Join Date
    Apr 2000
    Posts
    215
    you could do it using the vb mid function

    Code:
    Dim strArt as String
    Dim FirstChar as String
    strArt = "Art"
    FirstChar = mid$(strArt, 1, 1)'Get the first Character out of the string strArt
    that should do it.

  3. #3
    Guest
    Use the Left function.

    Code:
    Dim strArt As String
    Dim FirstChar As String
    strArt = "Art"
    FirstChar = Left(strArt, 1)

  4. #4
    Addicted Member
    Join Date
    Apr 2000
    Posts
    215
    I hate using the left method I don't know why, I just prefer to use the mid method over the left and right functions.

    Also I showed how to do it using the mid way rather than the left way as he has posted this topic in the general question forum as well and someone has already mentioned the left way in that topic so I thought I'd add a bit of variety for him and put the mid way in this topic lol.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    323
    thanks to both of you. But I did end up using the LEFT function. I'm sure both do work. Thanks again
    If you think education is expensive, try ignorance.

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