UTF-8 で,ASCII 文字と漢字かな混じりの文字列から,m番目からn番目までの文字列を取り出すとき,Julia では直接的な関数(指定法)がないのかなあ?
index = collect(eachindex(s))
で何文字目か?という情報を取り出し,それに基づいて文字列を抽出する。
s = "123あいうえおabcde漢字仮名ひらがな"
index = collect(eachindex(s))
21-element Vector{Int64}:
1
2
3
4
7
10
13
16
19
20
21
22
23
24
27
30
33
36
39
42
45
s[index[3:5]]
"3あい"
s[index[12:15]]
"de漢字"
関数定義しておく
substring(s, range) = s[collect(eachindex(s))[range]]
そうすれば,
substring(s, 3:5)
"3あい"
substring(s, 12:15)
"de漢字"