Hello;
In a lot of languages, an elegant way exists to get a char
from a String.
While using Rust no elegant way exists as it is in python or others.
There are probably a lot of reasons why this is not in Rust but it is very inconvenient to use:
string.chars().nth(2)
While with Index or a get
function:
string[2]
Or:
string.get(2)
I think the same methods and implementations as Vec should be in String and &str: get
, unsafe get_unchecked
, Index<usize>
If someone can explain to me why it is not already in Rust STD or make an RFC that add this possibility in STD. I hope I don't sound too dumb. Thank's for reading; ccgauche.