Parse number String of other languages

You can not directly parse number String of language other then English in Java. To parse number String of other language say Hindi you can use following way,

NumberFormat numberFormat = NumberFormat.getInstance(new Locale("hi", "IN"));
try {
    Number number = numberFormat.parse("३५");
} catch (ParseException e) {

If you use above block of code it will print 35 in console.

You can only parse the number for one of the supported locales of Java.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s