var str; var ipos; str="111123456789+abc"; ipos = str.indexOf("+"); str1=str.substring(0,ipos); //取前bai部分duzhi str2=str.substring(ipos,str.length);//取后dao部分
var str = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAgEAyADIAAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABF" var ipos = str.indexOf(",") var str1 = str.substring(ipos,str.length) var ipos1 = str1.indexOf("/") console.log(str1.substring(ipos1,str1.length))