(String key, Object value)
| 17 | } |
| 18 | |
| 19 | public static KeyValue escape(String key, Object value) { |
| 20 | var string = value.toString(); |
| 21 | |
| 22 | string = string.replaceAll("\\\\", "\\\\\\\\"); |
| 23 | |
| 24 | var isQuoted = string.startsWith("\"") && string.endsWith("\""); |
| 25 | if (!isQuoted && string.contains(" ")) { |
| 26 | string = "\"" + string + "\""; |
| 27 | } |
| 28 | |
| 29 | return new KeyValue(key, string); |
| 30 | } |
| 31 | |
| 32 | String key; |
| 33 | String value; |
no test coverage detected