Results 1 to 3 of 3

Thread: '£' symbol in java

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Location
    London, Uk.
    Posts
    72

    Question '£' symbol in java

    Hey folks,

    Any ideas on how to display the '£' symbol in java run screen?

    e.g. I have: screen.println("Total price is £ " + cost);

    Thanks.

  2. #2
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Since DOS uses ASCII i doubt you will be able to print any unicode chracters.
    Code:
    class C {
     public static void main(String args[]){
    
      char c = '\u00a3'; //  pound sign '\u20a4' Lira 
      System.out.print(c);
      
       }
     }
    While DOS does extend the ASCII set beyond 128(which is technically ISO Latin-1) ie.....
    128 - 255(Special symbols, international character sets - generally these are non-standard characters) anything past 255 will just print out question marks.
    Code:
    class C {
     public static void main(String args[]){
    
      for(int i = 128; i < 256; ++i){ 
      System.out.print((char) i);
      
       }
      }
     }

  3. #3
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Once again we see that anything that falls out of the range of 0 to 28 - 1(0 - 255) will print ? marks.
    Code:
    class C {
     public static void main(String args[]){
    
      char c = '\u005a'; // 90(Z)
      System.out.println(c);
      char d = '\u013c'; // 400(?)
      System.out.println(d);
      }
     }

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