我大概这样一个数字序列 其中有1 2 3 之类的数字 但是又有些是带有 () 或者 (()) 【】 这类括弧的数字我想通过replace来实现像是将 1 2 3 替换成 2 3 4 的功能replace(1,2)replace(2,3)replace(3,4)但是里面遇到一个顺序问题 1被替换成2后 再次被替换成3 又被替换成4最终输入111结果会是444于是我将顺序倒序replace(3,4)replace(2,3)replace(1,2)虽然解决了这个问题 但是发现括弧造成的麻烦也与这个顺序问题相似同时两组顺序问题 就难以都解决了 请问有什么好方法吗?最后放上序列[ "((1))","((#1))","((2))","((#2))","((3))","((4))","((#4))","((5))","((#5))","((6))","((#6))","((7))", "(1)","(#1)","(2)","(#2)","(3)","(4)","(#4)","(5)","(#5)","(6)","(#6)","(7)", "1","#1","2","#2","3","4","#4","5","#5","6","#6","7", "[1]","[#1]","[2]","[#2]","[3]","[4]","[#4]","[5]","[#5]","[6]","[#6]","[7]", "[[1]]","[[#1]]","[[2]]","[[#2]]","[[3]]","[[4]]","[[#4]]","[[5]]","[[#5]]","[[6]]","[[#6]]","[[7]]" ]我实际想解决的是 将一个字串中 list[n]的内容替换成list[n+1]
- 2 回答
- 0 关注
- 381 浏览
添加回答
举报
0/150
提交
取消