aboutsummaryrefslogtreecommitdiff
path: root/man/man3/tomo-Text.at.3
blob: a1d303713b3438aaaf43dd38ae90ee52897b4a9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH Text.at 3 2025-11-29 "Tomo man-pages"
.SH NAME
Text.at \- get a letter
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Text.at\ :\ func(text:\ Text,\ index:\ Int\ ->\ Text)
.fi
.SH DESCRIPTION
Get the graphical cluster at a given index. This is similar to `str[i]` with ASCII text, but has more correct behavior for unicode text.


.SH ARGUMENTS

.TS
allbox;
lb lb lbx
l l l.
Name	Type	Description
text	Text	The text from which to get a cluster. 
index	Int	The index of the graphical cluster (1-indexed). 
.TE
.SH RETURN
A `Text` with the single graphical cluster at the given index.

.SH NOTES
Negative indices are counted from the back of the text, so `-1` means the last cluster, `-2` means the second-to-last, and so on.

.SH EXAMPLES
.EX
assert "Amélie".at(3) == "é"
.EE
.SH SEE ALSO
.BR Tomo-Text (3)