get_prev_char
Description:
Finds the previous UTF-8 character in the string before index
.
index
does not have to be at the beginning of a UTF-8 character. No check is made to see if the character found is actually valid
other than it starts with an appropriate byte.
Example: Utf8-handling, get_prev_char:
public static int main (string[] args) {
string wisdom = "一石二鳥";
int index = wisdom.length;
unichar c;
// Output: ``鳥二石一``
while (wisdom.get_prev_char (ref index, out c)) {
print (c.to_string ());
}
print ("\n");
return 0;
}
valac --pkg glib-2.0 string.get_prev_char.vala
Parameters:
index |
a byte offset to a unicode character encoded as UTF-8 |
c |
the location to store the next unichar |
Returns:
|