Results 1 to 2 of 2

Thread: Getting Ascii code

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    6
    Anybody know if there's a function to get the ascii value for a character? Like in VB, you can do Asc("a") or whatever.

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Since Java is all Unicode, that's what it will return, although you can use String.charAt(index):
    Code:
    String sMyString = "A string";
    char cNumber = sMyString.charAt(0);
    cNumber now contains the Unicode character code for 'A'. A simple translation array would probably be a much better bet for doing this, though.

    [Edited by parksie on 08-02-2000 at 03:07 PM]
    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