message.setPadCharacter¶
Signature: message.setPadCharacter(character)
Returns: void
Sets the pad character for a fixed length message. The default is ' '.
Note
This method only applies to Fxd Length formatted messages.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String | character | the pad character to use. Must not be null or blank, but be one character long. |
Example¶
// Example: Change the pad character used for a fixed-length message.
// assumes `message` is a fixed-length message model object, e.g. record length 20:
// 12345678901234567890
// Set pad character to '*'
message.setPadCharacter("*");
// Update a field; padding will use the new pad character
message.setNode("3,12", "aba");
// Access the updated fixed-length message
var updatedMessage = message.toString(); // "12aba*********567890"