Results 1 to 13 of 13

Thread: Char(1)

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    Im not sure how but I need the code to
    see if char one is a "," ..

    Thanks!

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Try:
    Code:
    If Left(Text1.Text, 1) = "," Then
        Msgbox "Comma start"
    Else
        Msgbox "No comma start"
    End If
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    Guest
    You can also use the Like operator
    Code:
    If Text1 Like ",*" Then Print "Yes" Else Print "No"

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Say, Megatron, is that Like operator a shortcut for the regexp stuff? Otherwise I'll just go back to the other method shown a while back.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    How do you get the last char if you dont know what it is??

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169

    :confused:

    What do you mean?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  7. #7
    Guest
    try:

    Code:
    Print Right(Txt)

  8. #8
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Oops...bad function call. Use Right(String, Length).
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  9. #9
    Guest
    Oops, sorry, it should be: Right(Txt, 1)
    If you want to get the last char.

  10. #10
    Guest
    Parksie: The Like operator is used for pattern matching (using wildcards if necessary).

  11. #11
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    So can you do stuff like:
    Code:
    Like "[0-9]-[a-z]"
    to match "0-a", "5-v" and things like that?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  12. #12
    Guest
    Yup, 0-9 will restrict to numbers only, but you can also use a pound sign for that.
    Code:
    If Chr(KeyAscii) Like "#" Then Print "Numeric"

  13. #13
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Thanks Megatron, that'll make my life a lot easier .
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

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