Results 1 to 11 of 11

Thread: newbie question .. plz dont hurt me .. ^_^

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Posts
    6

    Question

    i wus just wondering how to " extract " text from a variable? .. ie : if i had the word Testing in a variable how can i extract the first letter or such? ..

  2. #2
    Hyperactive Member barrk's Avatar
    Join Date
    Sep 2000
    Location
    My own little world
    Posts
    274
    dim myvariable as string

    myvariable = "Testing"

    myfirstletter = left(myvariable, 1)

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Posts
    6
    could ya explain how that works? ... just so i know how to change it around and such? ..

    btw thanx very much ... ^_^

    -XeoN-

  4. #4
    Hyperactive Member barrk's Avatar
    Join Date
    Sep 2000
    Location
    My own little world
    Posts
    274
    You define your variable

    you add some text

    you tell it to look as the first character starting from the left.

    if you want it to look at the second two characters you can do that too.

    mychar = left(myvariable, 2)

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Posts
    6

    Question

    and how do i extract stuff after the first letter? ... thx

    -XeoN-

  6. #6
    Hyperactive Member barrk's Avatar
    Join Date
    Sep 2000
    Location
    My own little world
    Posts
    274
    I would recommend that you look at the left, right and mid functions. They are very helpful!

    http://www.msdn.microsoft.com

  7. #7

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Posts
    6
    eek .. sorry for bugging ... *crys*

    -XeoN-

  8. #8
    Hyperactive Member barrk's Avatar
    Join Date
    Sep 2000
    Location
    My own little world
    Posts
    274

    Please, don't cry!

    You weren't bugging! We all are hear to learn! Never worry about posting questions.

    Good luck!

  9. #9
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    'here, play around with this
    'use a listbox or a msgbox or whatever
    'just count things, change things, see what happens

    Code:
    Private Sub Command1_Click()
        
        Dim x As String
        x = "help me out here, please."
        
        Dim a As String, b As String, c As String
        
        a = Left(x, 4)   'help
        a = Left(x, 1)   'h
        a = Left(x, 18)  'help me out here,"
        
        b = Mid(x, 6, 2)   ' me
        b = Mid(x, 13, 4)  'here
        b = Mid(x, 13, 13) 'here, please.
        
        c = Right(x, 7)   'please
        c = Right(x, 13)  'here, please.
        c = Right(x, 24)  'elp me out here, please.
    
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  10. #10
    Addicted Member
    Join Date
    Mar 2000
    Location
    Gainesville, FL
    Posts
    131
    The help files are a great source of information!

    Look at "working with variables" and such.

  11. #11

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Posts
    6
    WOOOOOOOOOHOOOOOOOOO! .. thanks guys ... your all so helpful .. i got it to werk ... ^_^ ...

    -XeoN-

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