Remove data from string

Hi ,

I have a data in string variable and require to remove the common element from the variable.

Eg.

abc Corporation INVOICE
address line1
address line 2
Tele.:(112) 123-123

XYZ CORPORATES
Address line 1
Address line 2
tele:(122) 456-343

S.NO DESCRIPTION PRICE
1 TEXT $120

abc Corporation INVOICE
address line1
address line 2
Tele.:(112) 123-123

XYZ CORPORATES
Address line 1
Address line 2
tele:(122) 456-343

S.NO DESCRIPTION PRICE
1 TEXT123 $130

So i want 'abc Corporation INVOICE
address line1
address line 2
Tele.:(112) 123-123

XYZ CORPORATES
Address line 1
Address line 2
tele:(122) 456-343’ this part to be removed so that i am left with only s.no,description,price fields and data.

any suggestion and the text to be removed is dynamic.

2 Likes

any solution?

1 Like

Hope these steps would help you resolve this
—is this the string input named str_input
—then use a assign activity like this
arr_output = str_input.Solit(Environment.NewLine.ToArray())
Where arr_output is a variable of type array of strings

—now pass this arr_output in FOR EACH activity and pass the variable named arr_output as input and change the type argument as string in the property panel
—inside the loop use ADD TO COLLECTIONS where mention the collections property as list_output where it is a variable of type System.Collections.Generic.List(of string) with default value defined in the variable panel as new list(of string)
And in the add to collections property with item property mentioned as item.ToString
Or
We can directly mention the item.ToString in writeline activity without creating any of this list collections of variable

So our string will be saved in the variable list_output and again we can pass this as input to for each loop and print as item.ToString which will give us only that string you asked for

Kindly try this and let know for any queries or clarification
Cheers @prateekjain1992

1 Like