Mutils

The Mutilsclass contains various useful utilities. Examples below:

Function Input Output
Encoding & Decoding Mutils.urlEncode("Hello world!") Hello%20world%21
Mutils.urlDecode("Hello%20world%21") Hello world!
Mutils.htmlEncode("<b>This & that</b>") &lt;b&gt;This &amp; that&lt;&#x2F;b&gt;
HTTP Dates Mutils.toHttpDate(new Date()) Sat, 29 Mar 2025 08:03:04 GMT
Mutils.fromHttpDate("Sat, 29 Mar 2025 08:03:04 GMT").toString() Sat Mar 29 08:03:04 UTC 2025
Object Utils Mutils.coalesce(null, null, "First non-null value") First non-null value
String Utils Mutils.nullOrEmpty("") true
Mutils.hasValue("Something") true
Mutils.trim("/some/path/", "/") some/path