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>") |
<b>This & that</b> | |
HTTP Dates | Mutils.toHttpDate(new Date()) |
Fri, 18 Apr 2025 05:58:11 GMT |
Mutils.fromHttpDate("Fri, 18 Apr 2025 05:58:11 GMT").toString() |
Fri Apr 18 05:58:11 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 |