iz.strings

iz string handling functions, mostly related to lexical scanning

Members

Functions

byLine
auto byLine(auto ref Range range)

Returns an input range consisting of each line in the input argument

bySeparated
auto bySeparated(auto ref Range range, Separators sep)

Returns an input range consisting of each separated word in the input argument

bySlice
auto bySlice(auto ref Range range, size_t len)

Returns an input range consisting of the input argument sliced by group of length len.

byWord
auto byWord(auto ref Range range)

Returns an input range consisting of each non-blank word in the input argument.

canRead
bool canRead(ref Range range, Stuff stuff)

Returns true if a string starts with a particular sub string.

escape
auto escape(Range range, const char[2][] pairs)

Escapes characters in the input text.

lineCount
size_t lineCount(Range range)

Returns the lines count within the input range. The input range is not consumed.

nextLine
auto nextLine(ref Range range)

Returns the next line within range.

nextSeparated
auto nextSeparated(auto ref Range range, Separators sep)

Returns the next separated word. Separators are always removed, white characters optionally.

nextSlice
auto nextSlice(ref Range range, T len)

Tries to make a fixed length slice by consuming range.

nextWord
auto nextWord(ref Range range, T charTester)

Returns the next word in the range passed as argument.

nextWord
auto nextWord(ref Range range)

Returns the next word within range. Words are spliited using the White characters, which are never included.

nextWordUntil
auto nextWordUntil(ref Range range, T charTester)

Returns the next word in the range passed as argument.

nullTerminated
auto nullTerminated(C c)

Returns an input range that processes directly a null terminated C string, without fully converting it to a phobos string.

readDecNumber
auto readDecNumber(auto ref Range range)

Immediatly reads a decimal number.

readEol
auto readEol(ref Range range)

Tries to read immediatly an EOL in range and returns it.

readHexNumber
auto readHexNumber(auto ref Range range)

Immediatly reads an hexadecimal number.

skipEol
void skipEol(ref Range range)

Tries to skip immediatly an EOL in range.

skipWord
void skipWord(ref Range range, T charTester)

Skips the next word in the range passed as argument.

skipWordUntil
void skipWordUntil(ref Range range, T charTester)

Skips the next word in the range passed as argument.

stripLeftWhites
void stripLeftWhites(auto ref Range range)

Strips leading white characters.

unEscape
auto unEscape(Range range, const char[2][] pairs)

Un-escapes characters in the input text.

wordCount
size_t wordCount(Range range)

Returns the word count within the input range. Words are separatedd by ascii whites. input range is not consumed.

Static variables

decimalChars
CharSwitch!("[0..9]") decimalChars;

a CharSwitch that verify characters for decimal numbers.

hexChars
CharSwitch!("[a..f]", "[A..F]", "[0..9]") hexChars;

A CharSwitch that includes the hexadecimal characters.

octalChars
CharSwitch!("[0..7]") octalChars;

a CharSwitch that verify characters for octal numbers.

whiteChars
CharSwitch!("[\t..\r]", ' ') whiteChars;

A CharSwitch that includes the white characters.

Structs

CharMap
struct CharMap

CharMap is an helper struct that allows to test if a char is within a set of characters.

CharRange
struct CharRange

CharRange is an helper struct that allows to test if a char is within a full range of characters.

CharSwitch
struct CharSwitch(A...)

The CharSwitch structure allows to define static sets of character.

SuffixArray
struct SuffixArray(T)

The suffix array is a data structure that can be used to test quickly the presence of a value in a list. It's also adapted to get completion proposals for a prefix.

Templates

isCharTester
template isCharTester(T)

Tests wether T is supported in the several scanning functions.

Meta