Replace String#format() with string interpolation.

This commit is contained in:
takezoe
2013-07-11 20:19:11 +09:00
parent 81fe467b20
commit 72e2c6dca7
13 changed files with 49 additions and 47 deletions

View File

@@ -11,9 +11,9 @@ trait Validations {
def identifier: Constraint = new Constraint(){
def validate(name: String, value: String): Option[String] =
if(!value.matches("^[a-zA-Z0-9\\-_]+$")){
Some("%s contains invalid character.".format(name))
Some(s"${name} contains invalid character.")
} else if(value.startsWith("_") || value.startsWith("-")){
Some("%s starts with invalid character.".format(name))
Some(s"${name} starts with invalid character.")
} else {
None
}