split not working correctly

前端 未结 4 852
误落风尘
误落风尘 2021-01-18 16:21

I am trying to save the groups in a string to an array so that I can use them in individual variables if I need to. For this I use split but for some reason I only

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-18 17:14

    ultimate_array = string_final.split("#\\$");
    

    The reason your split is not working correctly is that split uses regex and "$" is a special character for regexes(drekka)

提交回复
热议问题