Functions
padNullCharacters
padNullCharacters(
value
,chars
):string
Pads a string with null characters (\u0000
) at the end to reach a fixed length.
If the input string is shorter than the specified length, it is padded with null characters until it reaches the desired size. If it is already long enough, it remains unchanged.
Parameters
Parameter | Type | Description |
---|---|---|
value | string | The string to pad. |
chars | number | The total length of the resulting string, including padding. |
Returns
string
The input string padded with null characters up to the specified length.
Example
Padding a string with null characters.