One: string conversions to arrays
Example:
var str = "3:2;2:1";
To become
arr= [{
A: "3",
B: "2",
Bol:false
},{
A: "2",
B: "1",
Bol:false
}]
Realize:
var arr = Str.split (";"); var SRR = []; for (Let index = 0; index < arr.length; index++) { Srr.push ({ a:arr[index].split (":") [0], B:arr[index]. Split (":") [1], bol:false, }) }
The SRR is the desired array;
Two: arrays are converted into strings
Example:
arr= [{
A: "3",
B: "2",
Bol:false
},{
A: "2",
B: "1",
Bol:false,
}]
To become:
str = "3:2;2:1";
Realize:
var str = ""; for (var index = 0; index < arr.length; index++) { if (arr[index].a = = "" "| | arr[index].b = = "" | | This.fzz = = "" | | This.yzz = = "") {this . $message (' cannot have null values in the ' Ride Card settings '); } else{ str = str+arr[index].a+ ":" +arr[index].b+ ";"; } } str = str.substring (0,str.length-1);
The conversion between JS string and array