String.setLength()



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"