.length() / .toUpperCase()
Try it yourself →Length and case conversion.
Syntax
s.length() s.toUpperCase() s.toLowerCase()
Description
length() returns the character count. toUpperCase/toLowerCase convert casing (returns a new string). Concatenation is done with + or interpolation.
Example
def s = "HexLibrary" println s.length() println s.toUpperCase() println s.toLowerCase()
Expected output
10 HEXLIBRARY hexlibrary
When to use?
Input validation, case-insensitive comparison.