DoxigAlpha

format

Function parameters

Parameters

#
w:*std.io.Writer

The C0 control codes of the ASCII encoding.

Types

#
control_code
The C0 control codes of the ASCII encoding.

Returns whether the character is alphanumeric: A-Z, a-z, or 0-9.

Functions

#
isAlphanumeric
Returns whether the character is alphanumeric: A-Z, a-z, or 0-9.
isAlphabetic
Returns whether the character is alphabetic: A-Z or a-z.
isControl
Returns whether the character is a control character.
isDigit
Returns whether the character is a digit.
isLower
Returns whether the character is a lowercase letter.
isPrint
Returns whether the character is printable and has some graphical representation,
isWhitespace
Returns whether this character is included in `whitespace`.
isUpper
Returns whether the character is an uppercase letter.
isHex
Returns whether the character is a hexadecimal digit: A-F, a-f, or 0-9.
isAscii
Returns whether the character is a 7-bit ASCII character.
toUpper
Uppercases the character and returns it as-is if already uppercase or not a letter.
toLower
Lowercases the character and returns it as-is if already lowercase or not a letter.
lowerString
Writes a lower case copy of `ascii_string` to `output`.
allocLowerString
Allocates a lower case copy of `ascii_string`.
upperString
Writes an upper case copy of `ascii_string` to `output`.
allocUpperString
Allocates an upper case copy of `ascii_string`.
eqlIgnoreCase
Compares strings `a` and `b` case-insensitively and returns whether they are equal.
indexOfIgnoreCase
Finds `needle` in `haystack`, ignoring case, starting at index 0.
indexOfIgnoreCasePos
Finds `needle` in `haystack`, ignoring case, starting at `start_index`.
indexOfIgnoreCasePosLinear
Consider using `indexOfIgnoreCasePos` instead of this, which will automatically use a
orderIgnoreCase
Returns the lexicographical order of two slices.
lessThanIgnoreCase
Returns whether the lexicographical order of `lhs` is lower than `rhs`.
hexEscape
Replaces non-ASCII bytes with hex escapes.

= "abcdefghijklmnopqrstuvwxyz"

Values

#
lowercase
= "abcdefghijklmnopqrstuvwxyz"
uppercase
= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
letters
= lowercase ++ uppercase
whitespace
Whitespace for general use.

Source

Implementation

#
pub fn format(se: HexEscape, w: *std.io.Writer) std.io.Writer.Error!void {
    const charset = se.charset;

    var buf: [4]u8 = undefined;
    buf[0] = '\\';
    buf[1] = 'x';

    for (se.bytes) |c| {
        if (std.ascii.isPrint(c)) {
            try w.writeByte(c);
        } else {
            buf[2] = charset[c >> 4];
            buf[3] = charset[c & 15];
            try w.writeAll(&buf);
        }
    }
}