Skip to content

Instantly share code, notes, and snippets.

@alien11689
Created December 11, 2015 21:55
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 alien11689/521c346d741057467393 to your computer and use it in GitHub Desktop.
Save alien11689/521c346d741057467393 to your computer and use it in GitHub Desktop.
fun String.isPhoneNumber() = matches(Regex("\\d{11}"))
import spock.lang.Specification
class MyScriptSpec extends Specification {
def 'shoould check is string a phone number'() {
expect:
// '48123123123'.isPhoneNumber() // it does not work
MyScriptKt.isPhoneNumber("48123123123")
!MyScriptKt.isPhoneNumber("")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment