core :: Text :: escape_more_to_c
The result might no be legal in C but be used in other languages
assert "ab|\{\}".escape_more_to_c("|\{\}") == "ab\\|\\\{\\\}"
assert "allo???!".escape_more_to_c("") == "allo??\\?!"
# Escape additionnal characters
# The result might no be legal in C but be used in other languages
#
# ~~~
# assert "ab|\{\}".escape_more_to_c("|\{\}") == "ab\\|\\\{\\\}"
# assert "allo???!".escape_more_to_c("") == "allo??\\?!"
# ~~~
fun escape_more_to_c(chars: String): String
do
var b = new Buffer
for c in escape_to_c.chars do
if chars.chars.has(c) then
b.add('\\')
end
b.add(c)
end
return b.to_s
end
lib/core/text/abstract_text.nit:735,2--752,4