how do you do that ?
(sub_string/5 seems to count codepoints)
?- sub_string("•юніко́д•", 2, Len, 2, Sub).
Len = 5,
Sub = "ніко́".
?- # shouldve been 14, "юніко́д" !
how do you do that ?
(sub_string/5 seems to count codepoints)
?- sub_string("•юніко́д•", 2, Len, 2, Sub).
Len = 5,
Sub = "ніко́".
?- # shouldve been 14, "юніко́д" !
You could probably do something with string_codes/2:
?- string_codes("•юнікод•", C), length(C, L).
C = [8226,1102,1085,1110,1082,1086,769,1076,8226],
L = 9.
“bytes” requires knowing which representation is being used (I presume you’re thinking of UTF-8); it’s pretty easy to figure out how many points a particular code point is in UTF-8.