-
去除@个数字然后拼接成新字符串 组合柜中柜1812024>20立柱@20959>上贴块@20949
if(detail.idType == undefined){
detail.idType = ‘’;
}else{//截取@符号再拼接上
var newIdTypeStr ="";
if(detail.idType.indexOf(">") != -1){
//根据>截取
var idtypeStr = detail.idType.split(">");
for (var j = 0; j < idtypeStr.length; j++) {
if(idtypeStr[j].indexOf("@")!=-1){
//根据@截取,并取第一个字符串
newIdTypeStr+=">"+idtypeStr[j].split("@")[0]
}else {
newIdTypeStr+= idtypeStr[j];
}
}} detail.idType=newIdTypeStr; }
2.substring(int start,int last);
String a = “18MM香秀苹果”;
int last = rawMaterialType.indexOf(“M”);
String b = a.substring(0,last );
结果:b=“18”;
字符串截取
最新推荐文章于 2021-02-24 13:58:29 发布