Is there a way to count the number of certain characters in a string?
For example : how many occurrences of the characters 'a', '?', '<' In the drain "Hello, are you here ??".
Itself, while only with regular expressions, works, (right? Or is there another way?):
var my_text = document.getElementById('myTextArea'); var result = my_text.value.match(/[a\?\<]/g).length;
Everything is processed by onkeyup when typing, will accept any of your comments.
my_text.value.match(/[a\?\<]/g).length;
? all other methods will be perverted, for example: my_text.split (''). filter (function (a) {return ['a', '?', '<']. indexOf (a)> - 1;}). length - zb '11