4 Replies Latest reply: Feb 19, 2008 5:15 AM by 807603 RSS

    How to get ASCII value of string

      Hi there,
      I read a character from console through BufferedReader and now I want to get ASCII value of it.

      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      String str = br.readLine();

      I tried,
      int asciivalue =(int) str;

      but its giving error "Cannot cast from string to int"
      Please reply.