Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
bioDan61597yFucking hassle!
Cant you do something like:
(This is psudocode, i dont know Swift)
public static int str_index(str, n) {
return index(str.startIndex, offsetBy: n);
}
..
string[str_index(string, n)];
? -
Starting Swift 4 you can do String[x]
If I'm not mistaken now you can use: String.characters[x]
Though let's hope this revolutionary language doesn't fuck up our code again in the next release, been working with Swift since Jan 2015 and been crying once a year when new Swift is out 😒 -
Crazyrems537yGoogle brings me here after typing "swift fuckifg String.index"
What happened at Apple's quarters?
Related Rants
Getting the nth character of a string.
Every other language:
string[n]
Swift:
string[index(string.startIndex, offsetBy: n)]
undefined
swift