split the string by last comma
jquery, string
Solution
var s="Text1, Text2, Text,true";
var lastIndex = s.lastIndexOf(",")
var s1 = s.substring(0, lastIndex); //after this s1="Text1, Text2, Text"
var s2 = s.substring(lastIndex + 1); //after this s2="true"
Problem
I have string in jQuery. ``` var s = "Text1, Text2, Text,true"; ``` I need split this variable in two part: ``` var s1 = substring(...); //after this s1="Text1, Text2, Text" var s2 = substring(...); //after this s2="true" ``` Can you help me split variable?