Convert an array of bytes to a hexadecimal string.
Convert an array of bytes to a hexadecimal string.
the array of bytes
the hexadecimal string, with lower-case hex digits and no separators.
Convert a hex string to bytes.
Convert a hex string to bytes.
the hex string
Some(bytes)
if the string was succesfully parsed;
None
if the string could not be parsed.
Convert a string to a boolean.
Convert a string to a boolean.
This method currently understands the following strings (in any mixture of upper and lower case). It is currently English-specific.
true, t, yes, y, 1 false, f, no, n, 0
the string to convert
Right(boolean)
on success, Left(error)
on failure
Tokenize a string the way a command line shell would, honoring quoted strings and embedded escaped quotes.
Tokenize a string the way a command line shell would, honoring quoted strings and embedded escaped quotes. Single quoted strings must start and end with single quotes. Double quoted strings must start and end with double quotes. Within quoted strings, the quotes themselves may be backslash-escaped. Quoted and non-quoted tokens may be mixed in the string; quotes are stripped.
Examples:
val s = """one two "three four" "" for (t <- tokenizeWithQuotes(s)) println("|" + t + "|") // Prints: // |one| // |two| // |three four| val s = """one two 'three "four'""" for (t <- tokenizeWithQuotes(s)) println("|" + t + "|") // Prints: // |one| // |two| // |three "four| val s = """one two 'three \'four ' fiv"e""" for (t <- tokenizeWithQuotes(s)) println("|" + t + "|") // Prints: // |one| // |two| // |three 'four | // |fiv"e|
the string to tokenize
the tokens, as a list of strings
Useful string-related utility functions.