1

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

1
  • 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

1

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

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

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

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?

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

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.

2
  • 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 .