Quote a string so that unprintable chars (in ASCII) are represented by C-style backslash expressions.
Quote a string so that unprintable chars (in ASCII) are represented by
C-style backslash expressions. For example, a raw linefeed will be
translated into "\n"
. Control codes (anything below 0x20)
and unprintables (anything above 0x7E) are turned into either
"\xHH"
or "\\uHHHH"
expressions, depending on
their range. Embedded backslashes and double-quotes are also quoted.
a quoted string, suitable for ASCII display
For every section of a string that matches a regular expression, call
a function to determine a replacement (as in python's
re.sub
).
For every section of a string that matches a regular expression, call
a function to determine a replacement (as in python's
re.sub
). The function will be passed the Matcher object
corresponding to the substring that matches the pattern, and that
substring will be replaced by the function's result.
For example, this call:
"ohio".regexSub("""h.""".r) { m => "n" }
will return the string "ono"
.
The matches are found using Matcher.find()
and so
will obey all the normal java rules (the matches will not overlap,
etc).
the regex pattern to replace
a function that takes Regex.MatchData objects and returns a string to substitute
the resulting string with replacements made
Converts foo_bar to fooBar (first letter lowercased)
Converts foo_bar to fooBar (first letter lowercased)
For example:
"hello_world".toCamelCase
will return the String "helloWorld"
.
Converts foo_bar to FooBar (first letter uppercased)
Converts foo_bar to FooBar (first letter uppercased)
For example:
"hello_world".toPascalCase
will return the String "HelloWorld"
.
Converts FooBar to foo_bar (all lowercase)
Converts FooBar to foo_bar (all lowercase)
For example:
"HelloWorld".toSnakeCase
will return the String "hello_world"
.
Turn a string of hex digits into a byte array.
Turn a string of hex digits into a byte array. This does the exact
opposite of Array[Byte]#hexlify
.
Unquote an ASCII string that has been quoted in a style like quoteC() and convert it into a standard unicode string.
Unquote an ASCII string that has been quoted in a style like
quoteC() and convert it into a standard unicode string.
"\\uHHHH"
and "\xHH"
expressions are unpacked
into unicode characters, as well as "\r"
, "\n"
,
"\t"
, "\\"
, and '\"'
.
an unquoted unicode string