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-12738] String(format:…) doesn't respect width and precision specifiers for $@ #53304

Open
swift-ci opened this issue Jun 11, 2019 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-12738
Radar None
Original Reporter rmann (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug
Assignee None
Priority Medium

md5: 5eb5642615be0864bce82383c8848162

Issue Description:

Swift's String(format:…) seems to ignore the minimum/maximum width specifier when applied to %@ conversions, unlike NSLog():

var s1 = String(format: "<%10.10@>", "Hello, playground")
print(s1)
var s2 = String(format: "<%10.10@>", "Hello")
print(s2)

prints:

<Hello, playground>
<Hello>

In Objective-C:

NSLog(@"<%10.10@>", @"Hello, playground");
NSLog(@"<%10.10@>", @"Hello");

prints:

<Hello, pla>
<     Hello>
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

1 participant