Scala how can I uppercase first character and lowercase others -


i have form takes user input , match in database. want first character uppercase , characters spaces , others lowercase. right have this

  location= location.split(' ').map(_.capitalize).mkstring(" ") 

the code above this: if user types 'new york' gets converted 'new york', if user types new york still want converted form 'new york'.

just convert lowercase first:

_.tolowercase.capitalize 

Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -