App icon 1Writer

count charactors

Shared by yaouo

count all text & selected text

Script

//全体&選択の文字数を数える。改行抜きでカウント。改行数も。
// 八百魚 http://yaouo.jp
atxt = editor.getText();
stxt = editor.getSelectedText();
atn1=atxt.length;
stn1=stxt.length;
atxt = atxt.replace(/\n/g, "");
stxt = stxt.replace(/\n/g, "");
atln = atn1 - atxt.length;
stln = stn1 - stxt.length;
ui.alert('------- all text -------\n characters =' + atxt.length + "\n line feed =" + atln + "\n total = " + atn1 + "\n\n----- selected text -----\n characters = " + stxt.length + "\n line feed = " + stln + "\n total = " + stn1);