1
我正在使我的DefaultStyledDocument的自定义实现。有时,我需要知道Document.insertString()方法会插入多少个字符(或已经插入)。如何通过Document.insertString()方法知道插入字符的数量?
但我没有找到如何计算它。 (insertString()方法本身无法帮助我,因为它返回void)。
那么有可能计算出这个值吗?
在此先感谢。
我正在使我的DefaultStyledDocument的自定义实现。有时,我需要知道Document.insertString()方法会插入多少个字符(或已经插入)。如何通过Document.insertString()方法知道插入字符的数量?
但我没有找到如何计算它。 (insertString()方法本身无法帮助我,因为它返回void)。
那么有可能计算出这个值吗?
在此先感谢。
你可以使用length()方法吗?即:
String s = "Example";
int len = s.length();
谢谢。的确,我的问题并不那么准确。我想知道,因为Styles的用途。 – loloof64 2013-03-02 18:09:42
没问题。继续编码:) – tmwoods 2013-03-02 18:12:48
是的:)编程是如此的有趣:) – loloof64 2013-03-02 18:17:23