Page tree
Skip to end of metadata
Go to start of metadata

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

Parameters
  1. String
  2. 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"