How can I know the number of inserted characters by Document.insertString() method?

73 Views Asked by At

I am making my custom implementation of DefaultStyledDocument. And sometimes, I need to know how many characters will be (or has been) inserted by the Document.insertString() method.

But I did not find how to compute it. (The method insertString() itself can't help me as it returns void).

So is it possible to compute this value ?

Thanks in advance.

1

There are 1 best solutions below

3
On BEST ANSWER

Can you use the length() method? i.e.:

String s = "Example";     
int len = s.length();