string
Strings are immutable UTF-8 text. Offsets in this module are byte offsets,
and s.len() is the length in bytes. Comparison needs no import: == compares
contents and < orders by UTF-8 bytes.
format is how you build text from values;
it is checked at compile time. For trimming, splitting, replacing and other
text helpers, see the stdlib text module.
Built into the compiler.
Import what you use (use path::* is not allowed):
use string::{byte_at, find_from};
Functions#
| Name | Description |
|---|---|
byte_at | Returns the byte at byte offset i of s, or -1 when i is out of range. |
find_from | Returns the byte offset of the first needle in hay at or after start, or -1. |
format | Builds a string from the literal fmt and the arguments that follow it. |
from_bytes | Decodes bytes as UTF-8 text. |
match_at | Returns whether needle occurs in s starting exactly at byte offset at. |
rfind | Returns the byte offset of the last needle in hay, or -1. |
slice_bytes | Returns the part of s between byte offsets start (inclusive) and end (exclusive). |
to_bytes | Encodes s as UTF-8 into a new Vec<byte>. |