4 ms·
Long for sure, but I really miss practical use cases, for example: > Asked how long the string is, you might say 12. However, Rust’s answer is 24: I get that,
by kowdermeister 9y ago
Long for sure, but I really miss practical use cases, for example:
> Asked how long the string is, you might say 12. However, Rust’s answer is 24:
I get that, `.len()` is tricky, but why not include an easy, common way to determine character length of a string in the documentation?
- steveklabnik 9y agoThere are different concepts of length depending on what you need. And not all of them are in the standard library, and hence, the book. “Character length” is not a Unicode concept, for example.
- kowdermeister 9y agoObviously, but it's a page about strings and a hint about how to get exact character length would be nice to have. But sure, the answer is just a googling away.
- steveklabnik 9y agoIt is true that we could point people to the ecosystem more. Historically, we've been worried about playing favorites. However, this can come into conflict with our principles of having a small stdlib. It's tough.