13. String operations

String operations group is intended to perform different data manipulations with JavaScript strings.

Let's say we have the following JavaScript file:
greeting = 'Hello, World !';

text = 'i can do it';

untrimmedText = '  No more excuses !   ';

fruits = ['Mango', 'Banana', 'Mango', 'Annona', 'Grape'];

The following table explains each operation and shows examples related to the JavaScript file above:

Operatoin Explanation Example Result
^U Uppercases a string.
${text^U}
I CAN DO IT
^U1 Capitalizes first letter in string.
${text^U1}
I can do it
^L Lowercases a string
${greeting^L}
hello, world !
^T Trims a string
${untrimmedText^T}
No more excuses !
^LEN Calculates string length
${untrimmedText^LEN}
22
^S Stringifying
${fruits^S}
["Mango","Banana","Mango","Annona","Grape"]

All those operations ( except ^S ) are applicable for strings and ignored for others.

You can chain those operations multiple times.
For example first trimming and then uppercasing:
${untrimmedText^T^U}

Watch a demo