0

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?

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
omoor
  • 73
  • 8

1 Answers1

1

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.

Joffrey
  • 32,348
  • 6
  • 68
  • 100
  • you got any in mind? It actually did prevent all that I knew of so I will upvote this, and once you answer me I'll also mark it as the answer – omoor Sep 08 '21 at 23:42
  • I never looked into this stuff so I don't know any in particular that wouldn't be "caught" by isBlank. But I'm sure there must some lists of non white-space characters that are nonetheless invisible. – Joffrey Sep 09 '21 at 00:02
  • There is this similar question: https://stackoverflow.com/questions/19936374/is-there-an-invisible-character-that-is-not-regarded-as-whitespace. The answers mention the BRAILLE PATTERN BLANK (U+2800) character as well as the 'ZERO WIDTH SPACE' (U+200B) – Joffrey Sep 09 '21 at 00:02