fromString Summary Converts a string to a byte value. Usage public static byte fromString(string numberAsStr) Returns The byte 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 a byte value. import System; byte x = UInteger8.fromString("100"); Console.log(x); // 100 If the string being converted is not a valid integer value, zero (0) is returned. import System; byte x = UInteger8.fromString("abc"); Console.log(x); // 0 If the string being converted is numeric but does not fit into the byte data range [ 0, 255 ] (inclusive), the value will be wrapped: if the value exceeds the byte maximum (255) by one, it will wrap around to the byte minimum (0); if the value exceeds the byte maximum by two, it will wrap around to the byte minimum plus one (1); and so on. import System; byte exceedByOne = UInteger8.fromString("256"); Console.log(exceedByOne); // 0 byte exceedByTwo = UInteger8.fromString("257"); Console.log(exceedByTwo); // 1 byte exceedByThree = UInteger8.fromString("258"); Console.log(exceedByThree); // 2 Examples Basic Usage 1234import System; byte x = UInteger8.fromString("100");Console.log(x); // 100 Share HTML | BBCode | Direct Link