Utils\Strings use strlen?

Notice: This thread is very old.
majo
Member | 21
+
0
-

In the method startsWith (endWith, findPrefix, after, pos .. etc) in class Utils\Strings

is used strlen? Why not self::strlen() when in this class exists ?

strlen return the number of bytes, no number of characters… e.g. UTF-8 string evaluate the improperly.

(sorry for my english)

Last edited by majo (2017-02-24 16:49)

Jan Tvrdík
Nette guru | 2595
+
0
-

That's intentional. Some UTF-8 string operations (such as startsWith) can be implemented on byte-level (instead of on character level) which is a lot faster. The current implementation is correct for all UTF-8 strings.