String manipulation wizard

i_declined
studio

#1

I am thinking of a string manipulation wizard that allows the user to select the text between two strings (at least).
This is how I extracted the text between two strings last time. I’m not sure this is the best way to do it, but we have to make this extraction much easier.
Invoice.Substring(Invoice.IndexOf(“Totaal te betalen €”) + “Totaal te betalen €”.Length).Split(Environment.NewLine.ToCharArray()).ElementAt(0).ToString.Trim()


#2

We can use Expressions here in sequential manner :

And there are many more predefined activities of these expression which we can play with.


#3

Why not use the Regex from provided samples in the library?
"(?<=" + labelBefore + ")(.*?)(?=" + labelAfter + ")"

There’s a whole workflow example for that.

Regards,
Andrzej


#4

A non-developer does not understand what a RegEx really is


#5

The workflow from the library can be altered to serve as an invokeable one, please see example below. This should lower the barrier of usage for non-developers.
Extract Text Between Labels.xaml (9.6 KB)

Please note that this method will only find the first occurrence and thus anything more complicated will require working with RegEx (or other matching mechanisms) anyway.

Baring that in mind, building this into an activity should be pretty easy, even with added occurrence# (like in OCR text find) functionality.

Regards.


#6

Yes, this may work, but in practice we have discovered that users that can not manipulate strings in .NET are not actually able to build production workflows. So there’s no use for this.


#7

We’ll ad in library lots of snippets based on the code activity.