modularml / mojo

The Mojo Programming Language
https://docs.modular.com/mojo/manual/
Other
23.1k stars 2.59k forks source link

[Feature Request] Add `stol` function #2639

Open YichengDWu opened 5 months ago

YichengDWu commented 5 months ago

Review Mojo's priorities

What is your request?

atol is in the std but not stol, a similar function to strtol in C.

What is your motivation for this change?

More functionalities to parser strings.

Any other details?

No response

gxyd commented 5 months ago

Can I maybe try to work on this issue?

soraros commented 5 months ago

@gxyd You can just go ahead!

bgreni commented 5 months ago

Since atol in mojo already accepts an optional base argument why would we have need for a second function in this case?

YichengDWu commented 5 months ago

atol recognizes "1234" and stol regonizes "1234asda".

bgreni commented 5 months ago

Ah I see the distinction between the behaviours now thank you.