1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-11-22 16:56:16 +00:00

Added a convenience method Any.toJson()

This commit is contained in:
Fabian Schlenz 2017-12-17 11:39:31 +01:00
parent 28931830eb
commit 93ad47639f

View File

@ -181,3 +181,8 @@ object Utils {
fun String.anonymize(): String { fun String.anonymize(): String {
return if (!CommandLineOptions.cmd_anonymize) this else this.replace(Regex("[0-9]"), "1").replace(Regex("[A-Z]"), "A").replace(Regex("[a-z]"), "a") + " (ANONYMIZED)" return if (!CommandLineOptions.cmd_anonymize) this else this.replace(Regex("[0-9]"), "1").replace(Regex("[A-Z]"), "A").replace(Regex("[a-z]"), "a") + " (ANONYMIZED)"
} }
fun Any.toJson(): String {
return Gson().toJson(this)
}