String.setLength()
The String.setLength() API allows you to set a length on a fixed length or a varying character string.
Parameters
String
Length
Return Value
String modified to the new length
Example
pjs.define("source", { type: 'char', length: 15, initValue: 'Dr. Doolittle', varying: true });
Â
source = String.setLength(source, 2);
Â
return source;
// "Dr"