While ApEx has an inbuilt character counter, I want to show the number of words entered as the user enters text into a textarea.
How would I go about achieving this?
While ApEx has an inbuilt character counter, I want to show the number of words entered as the user enters text into a textarea.
How would I go about achieving this?
Easiest way is to calculate the string length minus the string length after removing (single) whitespaces and then adding one. For example,
(length(text) - length(text, ' ',''))+1
This may not work if your text has multiple white space. You may wanna replace multiple whitespace with a single one, before doing this.
You can count number of white spaces and then add one to it. That would be a simple word counter. Regexp_count comes handy in this: https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions135.htm#SQLRF20014
SELECT REGEXP_COUNT('This is my life.', ' ', 1, 'i')+1 word_count FROM DUAL;