github.com/hugorut/terraform@v1.1.3/website/docs/language/functions/parseint.mdx (about) 1 --- 2 page_title: parseint - Functions - Configuration Language 3 description: >- 4 The parseint function parses the given string as a representation of an 5 integer. 6 --- 7 8 # `parseint` Function 9 10 `parseint` parses the given string as a representation of an integer in 11 the specified base and returns the resulting number. The base must be between 2 12 and 62 inclusive. 13 14 All bases use the arabic numerals 0 through 9 first. Bases between 11 and 36 15 inclusive use case-insensitive latin letters to represent higher unit values. 16 Bases 37 and higher use lowercase latin letters and then uppercase latin 17 letters. 18 19 If the given string contains any non-digit characters or digit characters that 20 are too large for the given base then `parseint` will produce an error. 21 22 ## Examples 23 24 ``` 25 > parseint("100", 10) 26 100 27 28 > parseint("FF", 16) 29 255 30 31 > parseint("-10", 16) 32 -16 33 34 > parseint("1011111011101111", 2) 35 48879 36 37 > parseint("aA", 62) 38 656 39 40 > parseint("12", 2) 41 42 Error: Invalid function argument 43 44 Invalid value for "number" parameter: cannot parse "12" as a base 2 integer. 45 ``` 46 47 ## Related Functions 48 49 * [`format`](/language/functions/format) can format numbers and other values into strings, 50 with optional zero padding, alignment, etc.