Utils\Strings use strlen?

2 years ago

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)

2 years ago

Jan Tvrdík
Nette guru | 2549
+
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.