[SOLVED] capitalizeFully in habpanel?

Hi all,
I need to convert a string for use in Habpanel.
The string is fully capitalised, such as “GOOD”.
I want to convert it to title case such as “Good”.
I tried capitalizeFully.(itemValue('itemName')) but this didn’t work.
I also tried (itemValue('itemName').toTitleCase) - also no good.
Any suggestions?

var String myString = "GOOD"
myString = myString.toLowerCase() // "good"
myString = myStringr.substring(0, 1).toUpperCase() + myString.substring(1) // "Good"
1 Like

Please mark the thread as solved, thanks

Here’s the final rule:

rule "Air Quality rules"
	Item airquality_aqi_local_aqiDescription changed
	var String myString = airquality_aqi_local_aqiDescription.state.toString()
	myString = myString.toLowerCase()
	myString = myString.substring(0, 1).toUpperCase() + myString.substring(1)

Thanks for your help!

Please tick the solution post, thanks

1 Like