The String.setLength() API allows you set a length of a string to a certain length.
Parameters
- String
- Length
Return Value
String with length that was passed
Example
pjs.define("source", { type: 'char', length: 15, initValue: 'Dr. Doolittle' }); source = String.setLength(source, 2); return source; //Dr