Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Convert a string to EDCDIC hex.

Parameters
  1. String
  2. Length to pad - if null, will use the length of the string value
Return Value

This API returns a JavaScript Buffer object. The length of the buffer is determined by the parameter. If the String value length is less than the length provided, the buffer will be padded with blanks. If the String value length is longer than the length provided, it will only convert the String characters in the length.

Exception Handling

If you pass in the incorrect amount of hex, it is possible that the Buffer module can throw an error.

Example

 

Code Block
languagejavascript
var myBuff = String.toEbcdicHex('Hello world');
var myString = String.fromEbcdicHex(myBuff.toString('hex'));