julia> "abc"[2]
'b': ASCII/Unicode U+0062 (category Ll: Letter, lowercase)
julia> s="abc"
"abc"
julia> s[1]
'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)
julia> s[2]
'b': ASCII/Unicode U+0062 (category Ll: Letter, lowercase)
julia> s="漢字"
"漢字"
julia> s[1]
'漢': Unicode U+6f22 (category Lo: Letter, other)
julia> s[2]
ERROR: StringIndexError("漢字", 2)
Stacktrace:
[1] string_index_err(::String, ::Int64) at ./strings/string.jl:12
[2] getindex_continued(::String, ::Int64, ::UInt32) at ./strings/string.jl:217
[3] getindex(::String, ::Int64) at ./strings/string.jl:210
[4] top-level scope at REPL[82]:1
julia> length(s)
2
|