Skip to content

Instantly share code, notes, and snippets.

@DaisukeNagata
Created March 7, 2021 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DaisukeNagata/ff207f636fc918dceaa342a67a915538 to your computer and use it in GitHub Desktop.
Save DaisukeNagata/ff207f636fc918dceaa342a67a915538 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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

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