Created
March 7, 2021 22:35
-
-
Save DaisukeNagata/ff207f636fc918dceaa342a67a915538 to your computer and use it in GitHub Desktop.
String_Split.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Author
DaisukeNagata
commented
Mar 7, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment