General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Core Dumped
comments
Comments by "" (@diadetediotedio6918) on "HOW COMPUTERS CAST STRINGS TO NUMBERS" video.
Before watching the response, this was the algorithm I came up with: ``` base = 10 str = "1030" println(string_to_int(str, base)) fn string_to_int(str: string, base: int) { let number = 0 each (index, char) of str { let digit = lookup_from(char) let exp = base ** len(str) - index - 1 number += digit * exp } return number } ```
1