## `int2text` -- convert an integer to a character string

#### Introduction

`int2text(`n, b`)` converts the integer `n` to a string that corresponds to the `b`-adic representation of `n`.

#### Call(s)

`int2text(n <, b>)`

#### Parameters

`n` | - | an integer
`b` | - | the base: an integer between 2 and 36. The default base is 10.

#### Returns

a character string.

#### Related Functions

`coerce`, `expr2text`, `genpoly`, `numlib::g_adic`, `tbl2text`, `text2expr`, `text2int`, `text2list`, `text2tbl`

#### Details

- The string returned by `int2text` consists of the first `b` characters in

      0, 1, ..., 9, A, B, ..., Z.

  For bases larger than 10, the letters represent the `b`-adic digits larger than 9: A = 10, B = 11, ..., Z = 35.
- For the bases 2, 8, or 16, `int2text` provides the conversion from decimal representation to binary, octal, or hexadecimal representation, respectively.
- `int2text` is the inverse of `text2int`.
- Since the output of the numerical datatypes in MuPAD uses the decimal representation, strings are used by `int2text` to represent `b`-adic numbers. The function `numlib::g_adic` provides an alternative representation via lists.
- `int2text` is a function of the system kernel.

#### Example 1

Relative to the default base 10, `int2text` provides a mere datatype conversion from `DOM_INT` to `DOM_STRING`:

    >> int2text(123), int2text(-45678)

                                  "123", "-45678"

#### Example 2

The decimal integer 32 has the following binary representation:

    >> int2text(32, 2)

                                     "100000"

The decimal integer 10^9 has the following hexadecimal representation:

    >> int2text(10^9, 16)

                                    "3B9ACA00"

#### Example 3

Negative integers can be converted as well:

    >> int2text(-15, 8)

                                       "-17"

#### Changes

- new function

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000