Skip to content

Add an example of converting a string to an int #140

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

Closed
nham opened this issue Jun 27, 2014 · 6 comments
Closed

Add an example of converting a string to an int #140

nham opened this issue Jun 27, 2014 · 6 comments

Comments

@nham
Copy link

nham commented Jun 27, 2014

The Rust cheatsheet was recently removed (see here) in favor of Rust by Example. One thing I used the cheatsheet for repeatedly, because I can never remember it for some reason, is how to convert a string to an int. Rust by Example does not appear to have such an example, or at least I was not able to find it by searching both on the site and on Github.

@nham nham changed the title Add an example of converting a string to an integer Add an example of converting a string to an int Jun 27, 2014
@japaric
Copy link
Member

japaric commented Jun 30, 2014

Rust by Example does not appear to have such an example

We don't have it at the moment. (Would you volunteer to write one? :-))


I think we should add two (or maybe just one) sub-chapters about FromStr and FromStrRadix, under the String chapter.

In any case, I think one should be able to find this example by searching for "conversion" or "convert" in the site searchbar.

@japaric japaric added the C-new label Jun 30, 2014
@nixpulvis
Copy link

Would it be a good idea to have a "Basic Operation" chapter with sections on things like this and other very common functions? For example sqrt or to_string.

@abonander
Copy link
Contributor

@nixpulvis I would put sqrt in a "Math Operations" chapter maybe. We should cover FromStr and to_string and casting e.g. int to f32 in a "Conversions" chapter.

@nixpulvis
Copy link

I like that, "Conversions" might make sense to go right after "Casting".

@maccoda
Copy link
Contributor

maccoda commented Oct 18, 2017

@steveklabnik Just wanted to check did we need anything else to close this one off? 😄

@steveklabnik
Copy link
Member

We're good!

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

6 participants