Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3113] iOS: String.format does not return correct result for given value

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionNeeds more info
Resolution Date2017-06-14T17:26:44.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sn/a
ComponentsiOS
Labelscore
ReporterJaime Fuhr
AssigneeIngo Muschenetz
Created2011-04-15T03:37:17.000+0000
Updated2017-06-14T17:26:45.000+0000

Description

String.format does not return a proper string for this code:

var result = String.format('%05d', 2);

The result should be '00002' but instead it returns '00000'. Build version is 1.5.1.

Another developer encountered an error using String.format in build 1.5.2. See http://developer.appcelerator.com/question/111041/trying-to-use-stringformat-for-leading-zero"> http://developer.appcelerator.com/question/111041/trying-to-use-str...

Thanks!
Jaime

Comments

  1. Stephen Tramer 2012-07-26

    Confirmed SDK 2.2.0.014b86f Test code:
       Ti.API.info(String.format('%05d', 2));
       
  2. Lee Morris 2017-06-14

    Closing ticket because the URL provided is no longer working so there's no way to find the test case.

JSON Source