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-6948] String has no method .append(_: Substring) #49496

Open
lilyball mannequin opened this issue Feb 7, 2018 · 1 comment
Open

[SR-6948] String has no method .append(_: Substring) #49496

lilyball mannequin opened this issue Feb 7, 2018 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella

Comments

@lilyball
Copy link
Mannequin

lilyball mannequin commented Feb 7, 2018

Previous ID SR-6948
Radar None
Original Reporter @lilyball
Type Bug
Environment

Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2)
Target: x86_64-apple-macosx10.9

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

md5: b6d112a1f87ab148dc2a8779a2187472

Issue Description:

String has a method .append(_: String) but it doesn't expose a corresponding .append(_: Substring). This seems like an obvious omission. There is .append(contentsOf:) that can be used with Substring but at a cursory glance it appears String doesn't try to optimize this. Similarly StringProtocol defines appending(_:) but this creates a new string instead of mutating the receiver.

@martinr448
Copy link

More candidates for taking a Substring (or StringProtocol) argument might be
hasPrefix(_ prefix: String) and hasSuffix(_ suffix: String)

@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