Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement StringIndex type #21

Open
koczkatamas opened this issue Feb 4, 2018 · 0 comments
Open

Implement StringIndex type #21

koczkatamas opened this issue Feb 4, 2018 · 0 comments
Assignees

Comments

@koczkatamas
Copy link
Collaborator

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 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant