RichTextArea - getText().length() for no-text mode returns different values

StackOverflow https://stackoverflow.com/questions/18039320

  •  23-06-2022
  •  | 
  •  

سؤال

After cut event occurs, I tried to get the RichTextArea inner text length with code like a

int l=getRichTextArea().getText().length();

... but

  • in FF it returns 0
  • in Chrome it returns 1

I couldn't have opportunity to test more internet browsers... So my question is...

Why does it happening? And is there a way to make it return correct value as 0 if richtextarea contains no text?

P.S. GWT 2.3

Thanks

هل كانت مفيدة؟

المحلول

If it's some blank string (like space char) you can use

getRichTextArea().getText().trim().length()
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top