# 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>

   ![](/files/wVX1j1aY3JjfP1RnSBN7)

   ![](/files/JiLV31ONO9ahcDOxInBH)

### Result

![](/files/MO6LUz3hlv1Dc15dKaf0)

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

## Links


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/cordova/string/padstring.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
