Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Unicode character

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi,
I have the following code:
//-----
1 public static String leer(BufferedReader sin) {
2 StringBuffer line = new StringBuffer();
3
4 try {
5
6 for (int ch; (ch = sin.read()) != 1; ){
7 line.append(ch);
8 }
9
10 } catch (IOException e) {
11 System.out.println("leer: " + e.toString());
12 }
13 if (linea != null)
14 System.out.println(line.substring(0));
15 return line.substring(0);
16 }
//-----
The problem is, at line 6, "sin.read()" returns a int (which is a unicode code) and I need the equivalent character to build a string. How can I obtain the character that corresponds to this unicode code?
Sorry if this is a simple question.
Thanks in advance.
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please don't cross post!!!
follow the thread here
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
    Bookmark Topic Watch Topic
  • New Topic