Get A Vec Of Uppercase Or Lowercase English Letters In Rust
Python has `ascii_lowercase``^lc^^ and `ascii_uppercase``^uc^^ to grab quick sets of ASCII letters. I haven't found anything like that in the Rust standard library. There's probably a crate that does it, but my quick search didn't turn up anything well maintained. The approach I'm using is to loop through the ASCII character codes to get the letters. Uppercase is 65-90 and lowercase is 97-122.
Code
Results
[_active_nvim_run:2:3] upper_case_letters() = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
]
[_active_nvim_run:3:3] lower_case_letters() = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
]
Note
Since writing this I found a StackOverflow answer that uses this appraoch. (TODO: test that and write it up)
Code
into_iter . .
Footnotes
-
(id:lc)
-
(id:uc)
-
(id:so)