is there an codename1 equivilent to java PrintFormat("%02d",value)

9 views
Skip to first unread message

Mark Bolduc

unread,
Mar 21, 2020, 9:39:58 AM3/21/20
to CodenameOne Discussions
If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans/Eclipse/IDEA NetBeans 11
Desktop OS Windows 10 Pro
Simulator Latest
Device All

Is there an codename1 class that can take a String format (%02d) with value of (int 6) and return a String "06" ?

Regards.


Shai Almog

unread,
Mar 21, 2020, 11:17:31 PM3/21/20
to CodenameOne Discussions
No. We don't have that.
I usually do:

private String twoDigits(int i) {
   
return i < 10 ? "0" + i : "" + i;

}


Reply all
Reply to author
Forward
0 new messages