Results 1 to 5 of 5
- 12-18-2012, 04:19 PM #1
Member
- Join Date
- Oct 2012
- Posts
- 5
- Rep Power
- 0
Class or library for alphabetic letters
Hi Guys (and girls?)!
I am looking for a class or library to do an easier mapping between english letters and non-english letters. It's maybe hard to understand with words (my bad english), so i can show you my method.
The code:
So in this case i want to convert the turkish letters to latin(english) letters. The problem is, it will take too much time to do this for all languages (excluding non-latin alphabets like arabic, hindi, chinese etc.), so is there any faster way to write this code, with help of a third-party library or something?Java Code:public String replaceForeign() { if (language.equalsIgnoreCase("tr")) for (int i = 0; i < name.length(); i++) switch (name.charAt(i)) { case 'ç': name.setCharAt(i, 'c'); break; case 'Ç': name.setCharAt(i, 'C'); break; case 'ğ': name.setCharAt(i, 'g'); break; case 'Ğ': name.setCharAt(i, 'G'); break;
Thanks in advance.
- 12-18-2012, 05:24 PM #2
Re: Class or library for alphabetic letters
The String class has methods for automatically replacing any pattern with another substring. You could use that.
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 12-18-2012, 05:48 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
Re: Class or library for alphabetic letters
Perhaps the Normalizer class can be of help (read the API documentation for that class).
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 12-18-2012, 05:49 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
Re: Class or library for alphabetic letters
Found this stack overflow thread, specifically the Normalizer part.
Essentially you use the normaliser to break down the character into its "parts" and grab the base (ascii) value.Please do not ask for code as refusal often offends.
- 12-19-2012, 02:08 PM #5
Member
- Join Date
- Oct 2012
- Posts
- 5
- Rep Power
- 0
Similar Threads
-
replace non alphabetic letters
By arvin in forum New To JavaReplies: 2Last Post: 10-31-2012, 02:55 PM -
Convert English letters to Tamil letters
By srinivasmallabathula in forum New To JavaReplies: 1Last Post: 10-20-2012, 02:39 PM -
How do you install and use a class library?
By ConMan in forum New To JavaReplies: 4Last Post: 06-07-2011, 09:39 AM -
Catching exception from another library (class)
By ezilka in forum New To JavaReplies: 15Last Post: 05-26-2010, 06:59 AM -
Search string for non-alphabetic characters
By turnergirl24 in forum New To JavaReplies: 5Last Post: 10-16-2009, 02:02 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks