我现在有如下一段字符串:
少锡:38,多锡:3,连锡:5,锡刺:0,锡渣:0,未焊:0
请问如下进行排序,转化成为:
少锡:38,连锡:5,多锡:3,锡刺:0,锡渣:0,未焊:0
------解决方案--------------------
- VBScript code
dim str:str = "少锡:38,多锡:3,连锡:5,锡刺:0,锡渣:0,未焊:0" dim arr:arr = split(str,",") for i = 0 to ubound(arr) dim temp,iv,jv for j = i to ubound(arr) iv = split(arr(i),":")(1) jv = split(arr(j),":")(1) if(int(iv) < int(jv)) then temp = arr(i) arr(i) = arr(j) arr(j) = temp end if next next Response.Write(join(arr,","))