Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

String.format behaves very odd in Ti 3.5.1 GA

$
0
0

*.xml
<String name="foobar">%d times</String>
 
*.js
var s = String.format(L('foobar'), 18);
// s = 18
The above is happening for 3.5.1 GA (Alloy 1.5.1, ran on iOS 8.1 simulator).

I just compared the functionality with 3.4.1 GA, and it seems to work properly on that build. Ive tried several things with keys like %1$s and %1$d or %s but it seems to behave irregularly.

Did I miss any change in usage? I'd like to have a formatter where I could just pass integers AND strings which doesnt choke on passing an integer where a string (%s) is expected. I'm about to make my own formatter but tbh I would rather not spend the time on it nor would I want to use any of the existing implementations which override the format function because this should just be working properly

(like: http://www.tidev.io/2015/01/26/formatting-strings-the-correct-way-using-an-old-friend-printf/ )


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>