Julia's UTF-8 string cannot use the slice operator because it cuts the byte index of the string, not the character. for example
s = "ポケットモンスター" s[1:4]
s [1: 4] will be "ポ ケ" not "ポ ケ ッ ト".
I would like to know the simplest and most readable way to get the UTF-8 substring in Julia.
You might want to use UTF32Stringinstead UTF8Stringif you are going to do this a lot, and only if necessary, if necessary, converting to UTF8String.
UTF32String
UTF8String
, ( Julia). , :
substr(s,i,j) = s[chr2ind(s,i):chr2ind(s,j)]
substr(s,1,4)
"ポケット"
Source: https://habr.com/ru/post/1626718/More articles:How to access the "Saved queries" programmatically? - google-bigqueryCan someone explain how this bitmask works? - cМалина Pi с использованием Python для mkdir - pythonWhat is an intuitive way to interpret bitwise operators and mask? Also, what is camouflage used for? - cReact - iosGetting key names for keyboard codes in Swift - swiftPHP mail () does not work - htmlSwift: CFArray: get values as strings UTF - stringполучение общей ошибки BulkWrite в MongoDB/Laravel - phpПочему API Instagram возвращает пустой результат? - pythonAll Articles