Friday, November 2, 2018

Using LPAD and RPAD for Formula functions

This article gives examples on using some common string functions that can be used for NetSuite search formulas via UI or script,
and custom formula fields.

LPAD: Pads the left-side of a string with a specific set of characters (when expr2 is not null).

Syntax: LPAD(expr1, n [, expr2 ]) 

Examples:
 LPAD('test', 7);  //returns '   test'
 LPAD('test', 2);  //returns 'te'
 LPAD('test', 8, '0');  // returns '0000test'

---------------

RPAD: Pads the right-side of a string with a specific set of characters (when expr2 is not null).

Syntax: RPAD(expr1 , n [, expr2 ])

Examples:
 RPAD('test', 7);  //returns 'test   '
 RPAD('test', 2);  //returns 'te'
 RPAD('test', 8, '0');  //returns 'test0000'

No comments:

Post a Comment