Is there a way to count words in a text string?
I'm using SQLite 3 and I'm trying to write a query that takes a bunch of long strings of text, and counts the number of words in each one.
I also want to ignore html tags (or anything between carets) such as paragraph tags, break tags, etc.
So when I run a query selecting text from the appropriate column, I get a large wordy text output with some html tags in it, and I just want to count the words.
How can I write a query to do this?
As far as I know there is no way to directly count the number of words in a string in SQL lite 3. (I'm more familiar with mysql and ms sql)
You can use Length and Replace as a work around
SELECT length(@String) - length(replace(@String, ' ', '')) + 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With