kgaoganyaMokwalo
→ splitTokens()Splits text into a list of pieces.
kgaoganyaMokwalo(boleng, dikgaolo)When you give nothing else, the text is split at every stretch of whitespace — a space, a tab, or a new line.
When you give a second value, every single character in it is a splitting place of its own. So kgaoganyaMokwalo("a;b,c", ";,") splits on ; and on ,, returning three pieces.
All the pieces come back as text. When you want numbers, pass them through palotlalo or palophatlo.
Note: kgaoganyaMokwalo is Bopa’s one word for splitting text. The built-in methods on the text itself — mokwalo.split(...) and the rest — still work.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
boleng | mokwalo | The text to split. |
dikgaolo (optional) | mokwalo | The delimiter characters. Each single character works on its own. Defaults to whitespace when omitted. |
Examples
Section titled “Examples”tiro setaLoeto() {
thalaKanefase(400, 400);
bokamorago(220);
tlogelaMothalo();
diri boleng = "240 120 40";
diri dikarolo = kgaoganyaMokwalo(boleng);
kwala(dikarolo);
diri r = palotlalo(dikarolo[0]);
diri g = palotlalo(dikarolo[1]);
diri b = palotlalo(dikarolo[2]);
tlatsaMmala(r, g, b);
thalaSediko(200, 200, 240);
}tiro setaLoeto() {
thalaKanefase(400, 400);
bokamorago(220);
tlogelaMothalo();
diri dikarolo = kgaoganyaMokwalo("60;120,180", ";,");
kwala(dikarolo);
diri x = 90;
gopheta (metlha karolo mo dikarolo) {
tlatsaMmala(0, 120, 200);
thalaSediko(x, 200, palotlalo(karolo));
x = x + 110;
}
}