Results 1 to 6 of 6
  1. #1
    minime12358 is offline Member
    Join Date
    Jul 2010
    Posts
    21
    Rep Power
    0

    Default String to Unicode

    Hey, I was wondering if there is a method to convert a string to an int array with their unicode values. Im fine if there isnt, I could convert to char array and then do a for loop to convert to an int array, but if there is already a method, that would be great.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default

    The String class would be the place to start looking.

  3. #3
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    5

    Default

    Quote Originally Posted by minime12358 View Post
    Hey, I was wondering if there is a method to convert a string to an int array with their unicode values. Im fine if there isnt, I could convert to char array and then do a for loop to convert to an int array, but if there is already a method, that would be great.

    Character.getNumericValue(char c) returns the unicode value of the character c

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,792
    Rep Power
    19

    Default

    Norm's already told him where to look...

  5. #5
    Prajin's Avatar
    Prajin is offline Senior Member
    Join Date
    Jun 2010
    Location
    Ktm, Nepal
    Posts
    120
    Rep Power
    0

    Default

    Java Code:
    String name = "name";
     int[] uni = new int[name.length()];
            for (int i = 0; i < name.length(); i++) {
                uni[i] = name.codePointAt(i);
                System.out.println("Unicode " + uni[i]);
            }
    This should do. It prints unicode value.

    -Regards

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,792
    Rep Power
    19

Similar Threads

  1. Unicode(UTF-8) to PDF
    By karasatishkumar in forum Advanced Java
    Replies: 0
    Last Post: 03-24-2010, 10:59 AM
  2. unicode as part of string
    By mac in forum New To Java
    Replies: 0
    Last Post: 01-28-2010, 02:23 AM
  3. Unicode string serach problem
    By saurabh01 in forum Advanced Java
    Replies: 2
    Last Post: 07-02-2009, 10:22 AM
  4. String/sentence to unicode convertion
    By sandeepvreddy in forum New To Java
    Replies: 5
    Last Post: 11-20-2008, 03:33 PM
  5. How to Draw Unicode String in Java
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-23-2008, 11:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •