How To Get The Word Count From A String – In UiPath

For a few business processes, you might be required to validate a sentence and then proceed forward.

So how can we find the count of the words in a string?

Let’s look at it…

no_OfWords = (our_String).Split(” “c).Count.ToString

Note:
Simply replace the “our_String” with your required “Sentence”


Example

Implementation using UiPath :

Let us implement a workflow which takes an “input from the user” which is a sentence and displays the “word count”.

Step 1:
Drag “Input Dialogue” activity into the design panel and save the user provided input into a variable.
i.e. “Sharath Raju”

UiPath Get the words count 1.PNG

Step 2:
Drag “Message Box” activity into the design panel and fill it with above-mentioned code.

UiPath Get the words count 2.PNG

Step 2:
Finally!!!

UiPath Get the words count 3.PNG

Click here to download the Source Code…

Hope it has helped you…

Leave a Reply

%d bloggers like this: