Question

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.

Was it helpful?

Solution

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

String s = "Example";     
int len = s.length();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top