string methods like split, match are not working when we enabled lockerservie for lightning. Need some help on this please.

  • You will need to raise a case with support.They have exposed some of the methods on case by case basics so please raise a case Jun 17, 2016 at 10:29

2 Answers 2


I've created this simple application to test the code:

    <aura:handler name="init" value="{!this}" action="{!c.init}"/>  

    init : function() {
        var ord =[{
                Ship_To_Details__c: "a|b|c"
        var i = 0;
        var sh=ord[i].Ship_To_Details__c.split("|"); 
        var oname = ["12345678901234567890"];
        var j = 0;
        var aname=oname[j].match(/.{1,15}/g);

And the output in the console is what we expect:

components/c/StringMethods.js:15 ["a", "b", "c"]
components/c/StringMethods.js:19 ["123456789012345", "67890"]

Everything looks fine here. What the error message you are seeing?

  • Hi,i am not sure what was the issue previously, however it works fine now. Jun 22, 2016 at 9:14

Locker Service exposes the javascript String class directly without proxying so there should be no interaction there at all. Please provide a more detailed description with example code.

  • Hi Doug, Some exampes are like "var sh=ord[i].Ship_To_Details__c.split("|");" and "var aname=oname[j].match(/.{1,15}/g);" match and split are not working. Jun 21, 2016 at 10:34
  • Scalar values like this (strings and numbers) should not be impacted by LS in any way - not sure what is going on here. We will look into it - do you have a case open with Salesforce support on this? Jun 21, 2016 at 13:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .