Transform Javascript Array into delimited String

后端 未结 7 707
别那么骄傲
别那么骄傲 2020-12-03 04:23

I have a Javascript string array with values like A12, B50, C105 etc. and I want to turn it into a pipe delimited string like this: A12|B50|C105...

How could I do th

相关标签:
7条回答
  • 2020-12-03 05:22
    <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> 
    <html> 
    <head> 
    <script> 
    var employee = new Array(); 
    employee.push("Yashwant"); 
    employee.push("Dinesh"); 
    employee.push("Mayur"); 
    var employeeStr = employee.join("|"); 
    alert('Delimited String :- ' + employeeStr); 
    var employeeArray = new Array(); 
    employeeArray = employeeStr.split("|"); 
    for(var x=0;x<employeeArray.length;x++){ 
    alert('Employee Name:- ' + employeeArray[x]); 
    } 
    </script>
    </head> 
    <body> 
    </body> 
    </html>
    
    0 讨论(0)
提交回复
热议问题