Wrong format from String.format()

by GPU » Mon, 06 Sep 2010 15:28:04 GMT


Sponsored Links
 Hi ,
passing two int values m =0 & s = 11, to below function
String formatted = String.format("%1$02d:%2$02d", m, s);

returning the value like   .0:11 ,What could be the problem  ?

m=0, s=11   -->   .0:11
m=0, s=1    -->    .0:.1

The 0 added to format the string always coming as '.' (dot).

Can anyone know ,from where the number patterns are getting loaded in
Android ?

I gone thorough the code ,Its related the following file ,
android\dalvik\libcore\icu\src\main\java\com\ibm\icu4jni\util
\Resources.java ->localeData.numberPattern

How the pattern for particular locale is loaded ,what could be the
problem for the above problem?

--



Wrong format from String.format()

by greg » Tue, 07 Sep 2010 00:18:35 GMT


 Did you want the 1$ and 2$ inside the field width specifications?




--


Sponsored Links


Wrong format from String.format()

by GPU » Tue, 07 Sep 2010 16:35:39 GMT


 String.format("%1$02d:%2$02d", m, s);
values ,m=0, s=11   -->   .0:11

expected result :   00:11
Actual result from android for Arabic Language :  .0:11

Analysis :
The android external\icu4c
for locale based number pattern  ,It just replacing the zeroDigit()
for padding values only ,the input values(m,n) remain same as US
locale

for arabic decimalPatternChars are below
DecimalFormatSymbols- >localeData.decimalPatternChars:
 #-
from above pattern the zeroDigit is \0660 (Arabic 0 digit)
So the output comes as mixed of the arabic & US digits -> .0:11

Is it a bug in Android?!






--



Other Threads

1. Ga bisa download dari market setelah di root! apa ada pengaruhnya?

pastiin gtalknya dah login...sol

sent from Pulsar 1.1 + GlassStone 4.0 - baca tux.or.id




om mau tanya....

saya pengguna HTC MAGIC 32A

kenapa saya abis root,ko ga bs download dari market yah?

apa ngaruh?

apa harus ada yang di setting?

udh di reset....

udah coba via wifi dan juga udh coba via APN,tapi terus aja starting
download,tapi ga download...

coba download dari i-music lancar download lagu,tapi download dari
market ga bisa....

saya di Root minggu kemaren kurang lebih,tapi baru dicoba hari ini....

kenapa yah?

apa ada yang harus di setting ulang?

--
"Indonesian Android Community [id-android]"

2. Nexus One hits FCC again, this time in CDMA trim

Remember how we figured out that an AT&T 3G-equipped Nexus One had stumbled its 
way into FCC certification not long ago? Using the same logic -- mainly label 
shape and model number -- we can safely say that this latest version to get 
approval is the dual-band CDMA variant that's almost certainly destined for 
Verizon within the next few months. There's not terribly much to see in the 
filing, but hey, take solace in knowing they've cleared this crucial 
bureaucratic hurdle (of course, Verizon's infamous internal testing is another 
bureaucratic hurdle altogether).

[Thanks to everyone who sent this in]

Nexus One hits FCC again, this time in CDMA trim originally appeared on 
Engadget on Fri, 26 Feb 2010 13:53:00 EST. Please see our terms for use of 
feeds.
Permalink   |  FCC  | Email this | Comments

http://www.engadget.com/2010/02/26/nexus-one-hits-fcc-again-this-time-in-cdma-trim/

--
This article was sent using my Viigo.
For a free download, go to http://getviigo.com


Sent from my BlackBerry onyx

-- 
"Indonesian Android Community [id-android]" 

3. MD5 Fingerprint

4. Vincent Kosasih wants to chat

5. what is the CRITICAL POINT of view layout to get hit by StackOverflowError exception

6. Dialog goes away on click of search button

7. Handling the menu and check boxes..