Style question: I have some text to process that n...
# announcements
n
Style question: I have some text to process that needs some easy one to one replacements. One of the replacement is changing escaped quote
\"
to just quote
"
...I cannot find a readable way to write that down as Pair. I came up with 3 ways to write that down and all of them are borderline unreadable:
Copy code
"\\\"" to "\""

"""\"""" to """""""

Pair("""
    \"
    """.trimIndent(),
    """
    "
    """.trimIndent())
It also does not help that Android Studio uses same color for
""""
as for String content.
e
this should work:
'\"'.toString() to '"'.toString()
if you don't need the pair to explitly be `String`s you can remove the
.toString()
n
So just characters? Yeah that looks better. Thanks.
k
Except that the first one is just
"
now. I'd say your original first ones are pretty readable, doesn't AS highlight the escape sequence in orange?
e
right, didn't try it:
"\\"+'"' to '"'.toString()
this actually works, but is not really much more readable
n
Yeah, I've noticed that first one stopped being 2 characters only after I've pasted it to tests yesterday..so I think that only proves that it was not perfectly readable. For tripple quotes
"""
AS displays whole String in green, for single
"
it display whole content in orange, so first version has "reasonable" highlighting.
Oh well, it is not that unreadable, and pretty small so I can write a comment there..
Also tests do check this.