Skip to main content

String

Represents a piece of utf-8 text.

string: String = "Woah!"

Associated functions​

from_data​

String::from_data(data: Data) -> String

is_valid_utf8​

Method that checks if a ByteArray contains a valid utf-8 encoded string.

String::is_valid_utf8(bytes: ByteArray) -> Bool

Operators​

==

String == String -> Bool

!=​

String != String -> Bool

+​

String concatenation.

String + String -> String

Methods​

encode_utf8​

Turns a String into a sequence of utf-8 bytes.

string.encode_utf() -> ByteArray

ends_with​

Checks if a String ends with a given suffix.

string.ends_with(suffix: String) -> Bool

serialize​

string.serialize() -> ByteArray

show​

Returns the string wrapped with quotes. This is useful when debugging.

string.show() -> String

starts_with​

Checks if a String starts with a given prefix.

string.starts_with(prefix: String) -> Bool