Skip to content

Commit 8fea2f7

Browse files
authored
Merge pull request #9134 from airspeedswift/delete-dead-code
2 parents 51c04e4 + a7def4b commit 8fea2f7

File tree

3 files changed

+0
-48
lines changed

3 files changed

+0
-48
lines changed

stdlib/public/core/StringLegacy.swift

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -413,44 +413,6 @@ extension String {
413413
}
414414
}
415415

416-
extension String {
417-
/// Split the given string at the given delimiter character, returning the
418-
/// strings before and after that character (neither includes the character
419-
/// found) and a boolean value indicating whether the delimiter was found.
420-
public func _splitFirst(separator delim: UnicodeScalar)
421-
-> (before: String, after: String, wasFound : Bool)
422-
{
423-
let rng = unicodeScalars
424-
for i in rng.indices {
425-
if rng[i] == delim {
426-
return (String(rng[rng.startIndex..<i]),
427-
String(rng[rng.index(after: i)..<rng.endIndex]),
428-
true)
429-
}
430-
}
431-
return (self, "", false)
432-
}
433-
434-
/// Split the given string at the first character for which the given
435-
/// predicate returns true. Returns the string before that character, the
436-
/// character that matches, the string after that character,
437-
/// and a boolean value indicating whether any character was found.
438-
public func _splitFirstIf(_ predicate: (UnicodeScalar) -> Bool)
439-
-> (before: String, found: UnicodeScalar, after: String, wasFound: Bool)
440-
{
441-
let rng = unicodeScalars
442-
for i in rng.indices {
443-
if predicate(rng[i]) {
444-
return (String(rng[rng.startIndex..<i]),
445-
rng[i],
446-
String(rng[rng.index(after: i)..<rng.endIndex]),
447-
true)
448-
}
449-
}
450-
return (self, "🎃", String(), false)
451-
}
452-
}
453-
454416
extension String {
455417
@available(*, unavailable, message: "Renamed to init(repeating:count:) and reordered parameters")
456418
public init(count: Int, repeatedValue c: Character) {

test/Constraints/members.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ var zcurriedFull = z.curried(0)(1)
8989
// Module
9090
Swift.print(3, terminator: "")
9191

92-
var format : String
93-
_ = format._splitFirstIf({ $0.isASCII })
94-
9592
////
9693
// Unqualified references
9794
////

validation-test/stdlib/String.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,6 @@ StringTests.test("ForeignIndexes/removeSubrange/OutOfBoundsTrap/2") {
314314
acceptor.removeSubrange(r)
315315
}
316316

317-
StringTests.test("_splitFirst") {
318-
var (before, after, found) = "foo.bar"._splitFirst(separator: ".")
319-
expectTrue(found)
320-
expectEqual("foo", before)
321-
expectEqual("bar", after)
322-
}
323-
324317
StringTests.test("hasPrefix")
325318
.skip(.nativeRuntime("String.hasPrefix undefined without _runtime(_ObjC)"))
326319
.code {

0 commit comments

Comments
 (0)