Wednesday, June 5, 2019

Replace All Occurrences of a String in SuiteScript


  1. Perform a global replacement:
    var string = "HeLLo world!";  
    var result = string.replace(/l/g, "");
    Result: "HeLLo word!"

  2. Perform a global, case-insensitive replacement:
    var string = "HeLLo world!"; 
    var result = string.replace(/l/gi, "");
    Result: "Heo word!"

No comments:

Post a Comment