Versions Compared

Key

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

The String.setLength() API allows you to set a length on a fixed length of or a varying character string to a certain length.

Parameters
  1. String
  2. Length
Return Value

String with length that was passedmodified to the new length

 

Example

 

Code Block
pjs.define("source", { type: 'char', length: 15, initValue: 'Dr. Doolittle', varying: true });
 
source = String.setLength(source, 2);
 
return source;
// "Dr: