Currently we are using a workaround which is really slow (indexing is O(N) instead of the expected O(1)) and really ugly (String(str[str.index(str.startIndex, offsetBy: i]) instead of str[i]).
So we have to introduce a StringIndex type which uses number underlying on every language expect Swift where it maps to String.Index type. We also need to add some helper methods eg. str.startIndex which gives 0 usually, except in Swift where it gives str.startIndex.
You cannot index a string with a number in Swift.
Currently we are using a workaround which is really slow (indexing is
O(N)
instead of the expectedO(1)
) and really ugly (String(str[str.index(str.startIndex, offsetBy: i])
instead ofstr[i]
).So we have to introduce a StringIndex type which uses number underlying on every language expect Swift where it maps to
String.Index
type. We also need to add some helper methods eg.str.startIndex
which gives0
usually, except in Swift where it givesstr.startIndex
.