Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18640] String.Format truncates text after %d

GitHub Issuen/a
TypeBug
PriorityHigh
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterBert Grantges
AssigneeUnknown
Created2015-03-05T19:43:00.000+0000
Updated2018-02-28T19:54:49.000+0000

Description

When using String.Format(), if you include a number any remaining characters will be removed from the final output. In your Titanium App:
var forename = 'Paul';
var number = 21;
var message = String.format('Welcome, %s! You are visitor number %d', forename, number);
console.log(message);
Notice that this outputs as expected:

Welcome, Paul! You are visitor number 21

Now try the same code except this time add some additional text after you use the %d

var forename = 'Paul';
var number = 21;
var message = String.format('Welcome, %s! You are visitor number %d isn't that great!?', forename, number);
console.log(message);

Then take a look at the output -

Welcome, Paul! You are visitor number 21

Notice that the remaining text content is removed.

Comments

  1. Hagen 2015-04-08

    Can someone give us any hints about an upcoming fix (or not)?
  2. Ingo Muschenetz 2015-04-08

    [~jonalter] is this related to the fix you did recently?

JSON Source