aiken/primitive/string
Functions
Constructing
Convert a ByteArray
into a String
This functions fails if the underlying ByteArray
isn’t UTF-8-encoded. In particular, you cannot convert arbitrary hash digests using this function.
For converting arbitrary ByteArray
s, use bytearray.to_hex.
string.from_bytearray("foo") == @"foo"
string.from_bytearray(#"666f6f") == @"foo"
string.from_bytearray(some_hash) -> fail
Convert an Int
to its String
representation.
string.from_int(42) == @"42"
Combining
Combine two String
together.
string.concat(left: @"Hello", right: @", World!") == @"Hello, World!"
Join a list of strings, separated by a given delimiter.
string.join([], @"+") == @""
string.join([@"a", @"b", @"c"], @",") == @"a,b,c"
Transforming
Convert a ByteArray
into a String
This functions fails if the underlying
ByteArray
isn’t UTF-8-encoded. In particular, you cannot convert arbitrary hash digests using this function.For converting arbitrary
ByteArray
s, use bytearray.to_hex.
string.from_bytearray("foo") == @"foo"
string.from_bytearray(#"666f6f") == @"foo"
string.from_bytearray(some_hash) -> fail
Convert an Int
to its String
representation.
string.from_int(42) == @"42"
Combine two String
together.
string.concat(left: @"Hello", right: @", World!") == @"Hello, World!"
Join a list of strings, separated by a given delimiter.
string.join([], @"+") == @""
string.join([@"a", @"b", @"c"], @",") == @"a,b,c"