From: Jacek S. <arn...@gm...> - 2007-12-05 20:32:44
|
> string.subutf8(string, start[,end]) substrings, UTF-8 aware > pos, char = string.nextutf8(string, orig_pos) returns the char at orig_pos and the next char's position in pos. > for i, char in str:nextutf8(orig_pos) iterates through the string, starting at orig_pos. > pos = string.seekutf8(string, orig_pos, n) returns the position orig_pos, N characters forward (or backwards, if N negative). > char = string.utf8char(code) returns the char the code of which is code. > code = string.utf8code(char) returns the code of char (UTF-8 character). > len = string.lenutf8(string) returns the length of string in UTF-8 characters. > > and can be used when one has something exactly to count (for example for checking the length of nicks, counting words and chars of chats) these seem to be of limited use since they treat utf-8 as a special case. > The slnunicode libary is much bigger and adds the table "unicode.utf8" which is similar to the string libary. > When one replaces for example str:match(...) with unicode.utf8.cbb_match(msg, ...) it should do the same as before and works also for utf8. (i did a mistake and renamed match to cbb_match) > I think it should be used for simple hubcommands like +reg nick or for things like bad word filters. Are you the author of the library? Or how did you make a mistake? Did you change the library? > The first libary is maybe optional when one uses slnunicode. Well, it seems easier to maintain just one library instead of two, so if the bigger library contains the functionality of the smaller one, I see no point in adding the small one... /J |