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
Post a Comment