-
- All Implemented Interfaces:
public class Taintable.Companion
-
-
Field Summary
Fields Modifier and Type Field Description public final static Taintable.Companion
INSTANCE
-
Method Summary
Modifier and Type Method Description final String
stringify(String s)
Surrounds strings with double quotes and escapes any internal double-quotes. final String
stringify(Taintable ts)
Surrounds Taintables with double quotes and escapes any internal double-quotes, line-feeds, or dollar-signs. final String
charToStr(Character c)
Surround chars with single quotes and escape any internal single- or double-quotes -
-
Method Detail
-
stringify
final String stringify(String s)
Surrounds strings with double quotes and escapes any internal double-quotes. This was written for debugging, but using a project like Indented lets you create object graph representations that actually compile to those objects (they can be homoiconic). You can copy homoiconic representations from your debugging output and paste them directly into unit tests. Code-as-data (and data-as-code) is handy. Just sayin'.
This is also an example of how to escape output for a specific purpose. In this case, Kotlin and Java Strings. You may wish to make your own encoding methods for other output types: htmlify, csvify, etc. or even wrapper types for encoded data, or to wrap writers...
-
stringify
final String stringify(Taintable ts)
Surrounds Taintables with double quotes and escapes any internal double-quotes, line-feeds, or dollar-signs.
-
-
-
-