fromString Summary Converts a string to an int value. Usage public static int fromString(string numberAsStr) Returns The int equivalent of the string value or zero (0) if the string is not a numeric value. Parameters numberAsStr The string value to convert. Description Converts a string to an int value. import System; int x = Integer32.fromString("100"); Console.log(x); // 100 If the string being converted is not a valid integer value, zero (0) is returned. import System; int x = Integer32.fromString("abc"); Console.log(x); // 0 If the string being converted is numeric but does not fit into the int data range [ -2147483648, 2147483647 ] (inclusive), the value will be wrapped: if the value exceeds the int maximum (2,147,483,647) by one, it will wrap around to the int minimum (-2,147,483,648); if the value exceeds the int maximum by two, it will wrap around to the int minimum plus one (-2,147,483,647); and so on. import System; int exceedByOne = Integer32.fromString("2147483648"); Console.log(exceedByOne); // -2147483648 int exceedByTwo = Integer32.fromString("2147483649"); Console.log(exceedByTwo); // -2147483647 int exceedByThree = Integer32.fromString("2147483650"); Console.log(exceedByThree); // -2147483646 Examples Basic Usage 1234import System; int x = Integer32.fromString("100");Console.log(x); // 100 Share HTML | BBCode | Direct Link