# Generates a string of random alphanumeric characters, using the given length generator def alphanumeric_string(length: Uint) = string(length, ascii_alphanumeric_char()); # Generates a string of random lowercase ascii letters (a-z), using the given length generator def lowercase_ascii_string(length: Uint) = string(length, lowercase_ascii_char()); # Generates a string of random uppercase ascii letters (A-Z), using the given length generator def uppercase_ascii_string(length: Uint) = string(length, uppercase_ascii_char()); # Generates a string of random characters from the unicode basic multilingual plane def unicode_string(length: Uint) = string(length, unicode_char()); # adds a newline character to the end of the input def trailing_newline(input: String) = concat(input, "\n"); # Surrounds the given string with the given characters def surround(inner: String, outer: String) = outer() { out -> concat(out, inner, out) }; # Surrounds the input with single quote characters (') def single_quote(to_quote: String) = surround(to_quote, "'"); # Surrounds the input with double quote characters (") def double_quote(to_quote: String) = surround(to_quote, "\""); # Convenience function for getting a Binary representation of a string as utf-8 encoded bytes. # For any other encodings, use the `string_bytes` function. def utf8_bytes(string: String) = string_bytes("utf-8", string);