Skip to content

Commit

Permalink
std::conv: add the atoi function
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Mar 12, 2024
1 parent 136f505 commit 2da1e30
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions std/conv/atoi.jule
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,8 @@ pub fn parse_int(mut s: str, base: int, mut bit_size: int)!: i64 {
}
ret n
}

// Is equivalent to parse_int(s, 10, 0), converted to int.
pub fn atoi(s: str)!: int {
ret int(parse_int(s, 10, 0) else { error(error) })
}

0 comments on commit 2da1e30

Please sign in to comment.