Module core::str[src]

String manipulation

For more details, see std::str

Primitive Types

str

String manipulation

Modules

raw

Unsafe operations

Structs

CharOffsets

External iterator for a string's characters and their byte offsets. Use with the std::iter module.

CharRange

Struct that contains a char and the index of the first byte of the next char in a string. This can be used as a data structure for iterating over the UTF-8 bytes of a string.

CharSplits

An iterator over the substrings of a string, separated by sep.

CharSplitsN

An iterator over the substrings of a string, separated by sep, splitting at most count times.

Chars

External iterator for a string's characters. Use with the std::iter module.

MatchIndices

An iterator over the start and end indices of the matches of a substring within a larger string

StrSplits

An iterator over the substrings of a string separated by a given search string

Utf16Items

An iterator that decodes UTF-16 encoded codepoints from a vector of u16s.

Enums

Utf16Item

The possibilities for values decoded from a u16 stream.

Traits

CharEq

Something that can be used to compare against a character

Str

Any string that can be represented as a slice

StrSlice

Methods for string slices

Functions

eq_slice

Bytewise slice equality NOTE: This function is (ab)used in rustc::middle::trans::_match to compare &[u8] byte slices that are not necessarily valid UTF-8.

from_utf8

Converts a vector to a string slice without performing any allocations.

is_utf16

Determines if a vector of u16 contains valid UTF-16

is_utf8

Determines if a vector of bytes contains valid UTF-8.

truncate_utf16_at_nul

Return a slice of v ending at (and not including) the first NUL (0).

utf16_items

Create an iterator over the UTF-16 encoded codepoints in v, returning invalid surrogates as LoneSurrogates.

utf8_char_width

Given a first byte, determine how many bytes are in this UTF-8 character

Type Definitions

AnyLines

An iterator over the lines of a string, separated by either \n or (\r\n).

Bytes

External iterator for a string's bytes. Use with the std::iter module.

Words

An iterator over the words of a string, separated by a sequence of whitespace