Hello,
How can I get the length of a string in NWC Workflow. I see there is a Length function in NWC Forms, but I am looking for this in NWC Workflows.
Thank you.
Best answer by SimonMuntz
View originalHello,
How can I get the length of a string in NWC Workflow. I see there is a Length function in NWC Forms, but I am looking for this in NWC Workflows.
Thank you.
Best answer by SimonMuntz
View originalMay or may not work depending on the string your starting with.
Hi,
My approach would be to use a Regular expression to split the string up into a collection.
The config would look like this:
Then use a Count Items in collection action to count how many letters there are in the collection.
For some reason the count is always one more than required so just use a calculate a value action to subtract one.
Workflow would look like:
Export Key valid until this time on the 24th of October:
ma8vjTraMZYyHn6CzTfFM3tZmXRbDYTKWG5sGGUwxgjkkxap2
Thank you for this alternative solution, @SimonMuntz .
I tested your example and it works great for a single word. The string we want to check the length of could be any number of words, spaces and punctuation. What regex would you recommend for that situation?
Thank you @SimonMuntz
The regex [Ss] did indeed work with multiple words. And it even worked when I included a trailing space.
I think this solution is cleaner than one I previously marked as the answer.
My only concern with @SimonMuntz suggestion, and this may be unfounded, was if there was a max limit on a collections size. I have no idea if there is one - but if there is, that may be a limitation you run into with that solution.
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.