I'm trying to split a string on backtick in the clojure repl, like this:
我试图在clojure repl中的反引号上拆分一个字符串,如下所示:
user> (require '[clojure.string :as str])
user> (str/split "1=/1`2=/2'" #"`'")
Result is:
结果是:
["1=/1`2=/2'"]
In short, I'm unable to split on the backtick character. And I don't know why. How can I make this work?
简而言之,我无法分解反击角色。我不知道为什么。我怎样才能做到这一点?
p.s:Notice the apostrophe at the end of the string and in the split argument. These are auto inserted in the repl.
p.s:注意字符串末尾和split参数中的撇号。这些是自动插入repl中。
1 个解决方案
#1
1
You have an extra '
in your regex.
你的正则表达式中有额外的'。
This works fine:
这很好用:
(str/split "1=/1`2=/2'" #"`")
#1
1
You have an extra '
in your regex.
你的正则表达式中有额外的'。
This works fine:
这很好用:
(str/split "1=/1`2=/2'" #"`")