Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-18279] Fixed String.format placeholder replacement for iOS Simulator #6624

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion iphone/Classes/KrollContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ static TiValueRef StringFormatCallback (TiContextRef jsContext, TiObjectRef jsFu
NSUInteger formatCount = [formatArray count];
NSMutableString* result = [[NSMutableString alloc] init];
@try {
for (size_t x=1; (x < argCount) && (x <= formatCount); x++)
size_t x=1;
for (; (x < argCount) && (x <= formatCount); x++)
{
NSString* theFormat = [formatArray objectAtIndex:(x-1)];
TiValueRef valueRef = args[x];
Expand All @@ -370,6 +371,10 @@ static TiValueRef StringFormatCallback (TiContextRef jsContext, TiObjectRef jsFu
[result appendString:[NSString stringWithFormat:theFormat,theResult]];
}
}
if (x-1 < formatCount)
{
[result appendString:[formatArray objectAtIndex:(x-1)]];
}
TiValueRef value = [KrollObject toValue:ctx value:result];
[result release];
return value;
Expand Down