Results 1 to 5 of 5

Thread: [RESOLVED] Extracting part of a string

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Resolved [RESOLVED] Extracting part of a string

    Hi all,

    How do you extract part of a string? I.e.

    [code]
    Dim LongString as string
    Dim ShortString as String

    LongString = "iounfdhvg9oi35ih7ns98ohf9h0p8hef"

    <Code to take the long string, and select the first 5 characters of it>

    ShortString = <Newly snipped string>

    MsgBox ShortString

    (In message box)
    iounf


    Any ideas?

  2. #2
    Fanatic Member paralinx's Avatar
    Join Date
    Jun 2005
    Location
    Michigan
    Posts
    987

    Re: Extracting part of a string

    The first 5 characters? Then use this.

    VB Code:
    1. Dim LongString as string
    2. Dim ShortString as String
    3.  
    4. LongString = "iounfdhvg9oi35ih7ns98ohf9h0p8hef"
    5.  
    6. ShortString = Mid(LongString, 1, 5)
    7.  
    8. MsgBox ShortString

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: Extracting part of a string

    Ahh! Great, thank you

  4. #4
    Fanatic Member paralinx's Avatar
    Join Date
    Jun 2005
    Location
    Michigan
    Posts
    987

    Re: [RESOLVED] Extracting part of a string

    No problem, and so you know how to use the Mid function later on:

    VB Code:
    1. string = Mid([B]string to be used[/B], [B]starting length in the string[/B], [B]length to end at[/B])

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: [RESOLVED] Extracting part of a string

    Oh? Great! I'll add it to my commands referances file. Thanks again!

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