github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/language/functions/parseint.html.md (about)

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