Description
Pad encoded text to a supplied code-point width with an explicit one-code-point zero symbol.
A positional encoding separates numeric digit values, alphabet symbols and final-block padding. An alphabet lookup is not a whole-stream codec, and character count can differ from the number of source bytes represented.
Pad encoded text to a supplied code-point width with an explicit one-code-point zero symbol.
When to use this tool
Use Base N Fixed Width Left Padding Count when checking one alphabet mapping or bounded encoding-padding term.
How to use the tool and how it works
- Enter encoded, width, zeroSymbol. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read padded, added. Use the output convention below.
Require whole width in [0,256], zeroSymbol containing exactly one Unicode code point and encoded having at most width code points. added = width-codePointLength(encoded); padded prepends that many zeroSymbol repetitions.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| encoded | Encoded | Required. Text; maximum UTF-16 length 8192. |
| width | Target length in Unicode code points, zero through 256. | Required. Safe integer; minimum 0; maximum 256. |
| zeroSymbol | Exactly one Unicode code point used for literal left padding. | Required. Text; maximum UTF-16 length 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| padded | Padded | Required. Text; maximum UTF-16 length 8192. |
| added | Added | Required. Safe integer. |
{
"input": {
"encoded": "abc",
"width": 5,
"zeroSymbol": "0"
},
"output": {
"padded": "00abc",
"added": 2
}
} Limitations and assumptions
- No alphabet or numeric equivalence is checked. Code-point width is not grapheme or display-cell width, and arbitrary padding may change an encoding's meaning.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Use the complete codec matching the intended alphabet and padding policy for real payloads and interoperability checks.
References
Similar or alternative tools
- Encoding: Base32 Pad Character Count
padCharacters is [0,6,4,3,1][byteCount modulo 5]; encodedLength = 8*ceil(byteCount/5).
- Encoding: Base64 Pad Character Count
padCharacters = (3-byteCount modulo 3) modulo 3; encodedLength = 4*ceil(byteCount/3).