eWebEditor Home >> eWebEditor Manual V8.0 >> Developer Guide >> JavaScript API

3.7.4 getCount


Returns the word count in editor content.


variable = getCount(int nType);


The only parameter is a type of character count, namely, the numeric type. It must be one of the following values:

0: Only ANSI character is counted.

1: Only Unicode character is counted.

2: Counted as Unicode, one Unicode character is counted as "plus one".

3: Counted as ANSI, one Unicode character is counted as "plus two".


The following example will get the number of character in the editor named 'myEditor'.

It is assumed that the content to be edited at present is "".

var n = myEditor.getCount(0);     // n=2

var n = myEditor.getCount(1);     // n=3

var n = myEditor.getCount(2);     // n=5

var n = myEditor.getCount(3);     // n=8