# padString

## Description

Generates a padded text. A padded text has additional characters added to either its beginning, end, or both sides to achieve a desired length or formatting.

## Input / Parameter

| Name   | Description                                              | Input Type  | Default | Options             | Required |
| ------ | -------------------------------------------------------- | ----------- | ------- | ------------------- | -------- |
| string | The value to be padded.                                  | String/Text | -       | -                   | Yes      |
| len    | The length of the new padded text.                       | Number      | 0       | -                   | Yes      |
| type   | The location of the 'string' within the new padded text. | String/Text | right   | right, left, center | Yes      |
| char   | The value to use as padding.                             | String/Text | ' '     | -                   | No       |

## Output

| Description               | Output Type |
| ------------------------- | ----------- |
| Returns the padded value. | String/Text |

## Callback

N/A

## Video

Coming soon.

## Example

The user wants to add padding to a string with maximum length of 10, with the original string at the center.<br>

### Step

1. Call the function `console`. Call the function `padString` inside the `value` parameter of the `console` function.\
   string: AB\
   len: 10\
   type: center\
   char: 1<br>

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-9369ce80fc901a1561734391af77c2dcbc12d781%2FpadString-step-1.png?alt=media)

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-34351674c870015bfa7565f2de211796604f8151%2FpadString-step-2.png?alt=media)

### Result

![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-c3adb03ed4279f38c6ddc5a450dfeba1c2b748f6%2FpadString-result-1.png?alt=media)

There are 4 characters '1' added on both the left & right side of "AB", making the total length of the string 10.

## Links
