文章浏览阅读626次。let ee =['1','2','3','4']let str1 = ''; for (let i = 0; i < ee .length; i++) { if (i <ee .length - 1) { str1 += ee [i] + ","; } else { str1 += ee [i]; } } consol.log(str1 )输出 1,2,3,4_ant 循环数组并通过......
一、原始文本word.txt内容a c b dd b c aa c d bc a r sd s g h二、shell脚本cat word.txt | sed 's/[ ][ ]*/,/g'脚本说明:s代表替换指令;每个[ ]都包含有一个空格;*号代表0个或多个;g代表替换每行的所有匹配; 还有一种方......
文章浏览阅读346次。字符串逗号分隔成字符串数组Given an array and we have to create a comma delimited string from the array without using library function. 给定一个数组,我们必须使用该数组创建一个逗号分隔的字符串,而无需使用库函数。 Example: ......