Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
String_Split.swift
import UIKit
var str = "Hell12o, p3laygrou4.5nd"
var ans = ""
str.forEach { s in
if (s.description.range(of: "[0-9-.]",
options: .regularExpression,
range: nil,
locale: nil) != nil) {
ans += s.description
}
}
print(ans)
@daisukenagata

This comment has been minimized.

Copy link
Owner Author

@daisukenagata daisukenagata commented Mar 7, 2021

スクリーンショット 2021-03-08 7 34 47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment