Le jeudi 26 novembre 2015 ร  09:04 -0800, JobJob a รฉcrit :
> Seems like if s[a:b] is intended to index into s.data, then the
> indexing should be consistent with arrays and s[end] should give the
> last byte, though since s[1] and s[5] return characters, not a single
> byte, there's a little bit of conflict.
> Ok I've found a lengthy discussion of this and related issues, and
> looks like this behaviour is very likely going to change: 
> https://github.com/JuliaLang/julia/issues/9297
> 
> In related news, this looks like an actual bug:
> 
> s = "๐Ÿ›€๐Ÿ›€"
> s12 = s[1:2] # "๐Ÿ›€"
> s56 = s[5:6] # "?"
> sizeof(s12)  # 4
> sizeof(s56)  # 2
> 
> The issue seems to be that
> nextind(s, 2) #5
> nextind(s, 6) #7 (prob should be 9) 
> 
> I think the fix is to change https://github.com/JuliaLang/julia/blob/
> master/base/strings/basic.jl#L141 to return sizeof(s)+1
> 
> Will file an issue.
Good catch! Instead of filing an issue, could you directly apply the
fix and make a pull request? Adding a test would also be a good idea to
be sure we don't regress on this.


Thanks!

> Good talk. :)
> Happy thanksgiving to those in the USA

Reply via email to