Kotlin
does not support the escape "\f"
(Form Feed Character). So what is the proper way port "\f"
from java
to Kotlin
?
Java:
String str = "\f"; // OK
Kotlin:
var str = "\f" // Illegal escape: '\f'
Anyway, that looked like a bug to me because Kotlin and java should work well together.
Use unicode escape \u000C
. Kotlin doesn't support the \f
escape. It isn't very widely used. - in fact I didn't realize that there is \f
in Java until seeing your question.
I made a table on the Java and kotlin escape sequence:
Escape type|kotlin |java \uXXXX yes yes \XXX no yes // this is Java octal escape. \t yes yes \b yes yes \n yes yes \r yes yes \f no yes \' yes yes \" yes yes \\ yes yes \$ yes no // Java just uses $
(Kotlin needs the escaped $ because string templates use $.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With