Skip to content

Instantly share code, notes, and snippets.

@kazuhito-m
Created December 14, 2017 15:59
Show Gist options
  • Save kazuhito-m/5fa635195913d00a599621d8b0f54ff2 to your computer and use it in GitHub Desktop.
Save kazuhito-m/5fa635195913d00a599621d8b0f54ff2 to your computer and use it in GitHub Desktop.
def target = this.args[0]
/**
* ASCII(&ある種決まった記号)のみで構成されているかを真偽値で返す。
*/
def isAsciiOnly(text) {
def valids = ['-', '_']
for (c in text.split('')) {
if (((int) c) > 127 && !valids.contains(c)) return false
}
return true
}
println "結果 : " + isAsciiOnly(target)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment