Reputation: 258
I'm trying to get the popup text for the attack message into all caps, including pre-existing strings from the strings.xml
val playerString = getString( R.string.player )
val monsterString = getString( R.string.monster )
val playerHitMonster = Toast.makeText(this, "$playerString HIT $monsterString FOR $playerDam!", Toast.LENGTH_SHORT)
Is there a way to convert the playerString
and monsterString
into all caps? ( i.e., "Minotaur" to "MINOTAUR" )
Upvotes: 0
Views: 1446
Reputation: 2846
Convert the String to All Caps or All Lower just use this
Solution:
1. yourString.uppercase() // ALL CAPS
2. yourString.lowercase() // all lowers
Deprecated - Don't use this
Upvotes: 0
Reputation: 2667
To convert the String to All Caps just use this :
yourString = yourString.toUpperCase()
and for lower case use :
yourString = yourString.toLowerCase()
Upvotes: 4