Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Language Comparison

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I would like to know we can compare the words other than English in Java

for example, to check if the input string equals to some particular name say "ASHOK"

tempstring.equalsIgnoreCase("ASHOK").

what if the comparison to be done other than English, may be Korean/Chinese/Spanish..

Kindly advise

Thanks
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java source files don't need to be in ASCII. As long as you specify the encoding during compilation (using the "-encoding" switch), then the source file can contain strings in whatever encoding (like Unicode) you desire. That makes it possible to embed CJK characters within Java source code. A better solution than hard-coding would be to read the strings from a file, though.
 
Sheriff
Posts: 22791
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

rudresh kumar wrote:what if the comparison to be done other than English, may be Korean/Chinese/Spanish..


Check out java.text.Collator. Although I'm not sure whether or not in can compare ignoring the case.
 
What's that smell? Hey, sniff this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic