1

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 – Mohith Shrivastava Jun 17 '16 at 10:29
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?

| improve this answer | |
  • Hi,i am not sure what was the issue previously, however it works fine now. – Gautam Maheshwari Jun 22 '16 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.

| improve this answer | |
  • 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. – Gautam Maheshwari Jun 21 '16 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? – Doug Chasman Jun 21 '16 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.