android - Convert English numbers in a String to Arabic numbers -


i have multiple strings different formats need display in textviews. have no control on length or format of these strings. have numbers obly, text only, or combination of both.

my goal display strings in textviews, , in process, convert english numbers arabic numbers.

the following examples should clarify mean:

original string   >> converted string ===================================== test 123          >> test ١٢٣ test              >> test 123               >> ١٢٣ 

i started doing this:

txtview.settext(string.format(locale, "%d", fulltext)); 

but assumes have numbers in fulltext string.

could suggest how work around this?

lets fulltext string this

string fulltext = "1a2b3c"; 

replace instances of of numbers corresponding arabic numbers

fulltext = fulltext.replace("1","١").replace("2","٢").replace("3","٣"); 

etc. mean


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -