Android studio – Kotlin: How to know if a string is TRULY empty

Issue

By TRULY empty, I mean no ways to cheat it. there are many websites on the internet offering empty characters in order to cheat the system and send an empty message. I want to block every single way that this could happen. MY QUESTION IS: Is there any function in android studio that prevents such things from happening? a function which checks both if the string is empty and if it doesn’t contain any empty characters?? or do I have to do it manualy?

Solution

You can use isBlank to test for the most common whitespace characters (or emptiness), but you’ll have to check the exotic ones manually I’m afraid.

Answered By – Joffrey

Leave a Comment