I am using a velocity template for a FIX message containing ;
as the delimiter in the template file. I want to replace the ;
with \u000
character as delimiter when actualy publishing the message.
When I try msg.replaceAll(";", "\u000")
, compiler complains "error in unicode escape"?
What is the right way to do this in Scala?
Asked
Active
Viewed 267 times
0

212
- 915
- 3
- 9
- 19
-
`"foo;bar".replaceAll(";", """\\u000""")` => `foo\u000bar` is this what you wanted? – om-nom-nom Oct 09 '13 at 12:46
-
An extra 0 also seems to quieten the compiler complaint without the extra backslash - `"foo;bar".replaceAll(";", """\u0000""")` . I wonder which out of these would be correct for this message to be consumed correctly by downstream FIX clients? – 212 Oct 09 '13 at 12:55
1 Answers
0
(edit)Escape backslash or use triplequotes like om-nom-nom advised:
msg.replaceAll(";", "\\\\u000")
or
msg.replaceAll(";", """\\u000""")

pawel.panasewicz
- 1,831
- 16
- 27