At v0.1.0
Returns the byte at an index.
Package: Text
Signature
func At(self, index: uint) -> char8;
Parameters
| Name | Type | Description |
|---|---|---|
index | uint | The offset of the byte, in bytes. |
Returns
The byte at index, or the null character ('\0') when index is at or past Length — an out of range read reports rather than running off the end of the block. A null character is therefore ambiguous: it is also what a string that really holds one reports.
The index is a byte offset, not a character offset, so indexing into a multi-byte UTF-8 sequence yields one byte of it rather than the character.
Example
import Text::String;
func Main() -> int {
var text = String::From("Rux");
text.At(0); // 'R'
text.At(2); // 'x'
text.At(9); // '\0' -- out of range
text.Free();
return 0;
}