Snippet. Vala. Printing the Characters of a StringThis Vala example shows how to iterate through a string and print each character.
string text = "HELLO";
for (int i=0; i < text.char_count(); i++) {
string ch = text.get_char(text.index_of_nth_char(i)).to_string();
stdout.printf("%s\n",ch);
}
Updated on: 15 Dec 2025 |
|
|