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

[SR-13026] Formatted string initializer doesn't handle indexed arguments correctly #3981

Open
swift-ci opened this issue Jun 16, 2020 · 0 comments

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-13026
Radar None
Original Reporter arakul163 (JIRA User)
Type Bug
Environment

Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: d2dac59268fe35e55144f9eaa1453c67

Issue Description:

Description

Formatted string initializer doesn't handle indexed argument correctly if there's only one placeholder in format string.

Playground Code

import Foundation


let stringOne = String(format: "%2$@", "World", "Hello")
print(stringOne)


let stringTwo = String(format: "%2$@ %1$@", "World", "Hello", "!")
print(stringTwo)

Actual Output

World
Hello World

Expected Output

Hello
Hello World
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant