Counting words in a text string

Hello, it’s a pleasure tHello, it’s a pleasure to greet you. I need to create a new column that gives me the result of how many words a name contains. Example: Juan Antonio Zavala Perez has 4 words.

Thank you very much in advance


Hola Gfranco,

you can use the String Manipulation node for that:

Use the countChars function, count the spaces and add 1:

countChars($column$, " ")+1

Does this help?



Excellent qqilihq,

Thank you very much, it’s exactly what I need.


1 Like

Hi @Gfranco2021,

adding my two cents to this as counting words can be tricky. Just counting the spaces can lead to inaccurate results when you factor in human errors like leading / trailing or duplicated white space.

Here is an example workflow that shows four different approaches to count words. Please note that I found a potential bug in the text processing nodes.

PS. I forgot to share some kudos to @Vernalis as I put the new feature about collection sized at work already. Thanks again for implementing that so quickly :beers:



This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.