【发布时间】:2015-11-16 00:56:17
【问题描述】:
bang=[]
(33..126).each{|x| bang<<x.chr}
block=bang.repeated_permutation(2)
for i in 1..8836
x=block.next.join
if not "x".gsub("x",x).size==2
puts x
end
end
输出=>
\&
\'
\+
\0
\1
\2
\3
\4
\5
\6
\7
\8
\9
\\
\`
所以。这里有一个。显示导致 gsub 失败的特殊字符的小脚本......我希望找到一个解决方案让 gsub 100% 工作
【问题讨论】:
-
试着用简单的文字写出问题所在。所以人们知道你的代码是什么。
标签: ruby-2.0