From 2da1e309ff82e409d6296ebeb4c28d5d646055ff Mon Sep 17 00:00:00 2001 From: mertcandav Date: Wed, 13 Mar 2024 01:29:02 +0300 Subject: [PATCH] std::conv: add the atoi function --- std/conv/atoi.jule | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/std/conv/atoi.jule b/std/conv/atoi.jule index b62494b1d..51ab0f667 100644 --- a/std/conv/atoi.jule +++ b/std/conv/atoi.jule @@ -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) }) +}