CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 1999
    Location
    Nuernberg / Germany
    Posts
    80

    STRINGS!!! Help!!!

    How is it possible to get the hex or decimal value of one charater from a string?
    For example: I want the decimal value of the "a" from the "hallo" string. Does anybody know how to do that? Code would be helpful.
    Thanks and redards
    Sascha



  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: STRINGS!!! Help!!!

    MsgBox Hex$(Asc("a"))


  3. #3
    Join Date
    Aug 1999
    Location
    Nuernberg / Germany
    Posts
    80

    Re: STRINGS!!! Help!!!

    Hi Lothar,
    sorry if I didn't really said what I want. I have a string e.g. with 6 characters, but I don't know the contents. Now I want the decimal value of e.g. the third character of this specific string.
    Example: dim a As string
    a = ??(?)???
    Decimal value of the third character?
    How to do that?
    Tanks and regars
    Sascha


  4. #4
    Join Date
    May 1999
    Posts
    3,332

    Re: STRINGS!!! Help!!!

    to get a specific char from a string use the Mid function.
    To convert it to a decimal value use Asc.

    e.g. to convert the third char in string x

    a = asc(mid(x,3,1))


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

Featured