Join strings in array that starts with same name?

Hi, need your help again, Work in progress, and no my questin is:
I have made an array of string, each strings starts with a suppliers name. I run a For each supplier that works fine to collect data in each string. But several of the strings starts with same suppliers because of the format of my raw data ( wich I can not do any thing about, it’s a system generatet report)
Seach the net and forum for a best way do join strins but find no good answers.
Array is llike
string(1) Suppliers name 1 then a lot of text and numbers
string(2) Suppliers name 2 then a lot of text and numbers
string(3) Suppliers name 3 then a lot of text and numbers
string(4) Suppliers name 3 then a lot of text and numbers
string(5) Suppliers name 3 then a lot of text and numbers
string(6) Suppliers name 4 then a lot of text and numbers

In this case I want to join string (3) , (4) and (5) because it is the same supplier, then when I have one string for each supplier I can run it in my For Each.
Hope you understand :slight_smile:
regards Kåre

Hi, Couldn’t you do a For each and then do in your For each : if item.tostring.contains(Supplier) if True

JoinString = JoinString+StringArray+","

you can then if needed do a for each by doing JoinString.split(","C)

Apologises if I haven’t understood your request.

I will try :slight_smile:Problem is that sometimes a string from the suppliers contain data from the string before and sometimes no data I want to extract. I though it would be easier to manipulat the string from the supplier when I know all data is in this one string for each supplier.
But maybe what you suggest will work, because I know that each string from supplier I am interessted in should start with a match of date like in format \d{2}-[A-z]{3}-d{2}. So if the substring from suppliers don’t start with a date it will not read it.

Can you Post some Sample input Strings and expected Output? So WE can Help you faster. Thanks


This string have no information, not always string (0), but never starts line with a date.

Either I could merge strings from same supplier in arraySupplier, or when I split each supplier and run my For Each Date find a way to dismiss strings without date. Runs fine when all lines starts with Date, but of course gives me error on strings without date of delivery, name of purchaser, order reference, county reference.

Tried using regex match, string contains, if contain and so on without sucsses.
Hope this makes it clearer,

I save the result in a Datatable with 5 colums for each line like this: suppliers name, date of delivery, name of purchaser, order reference and county reference.


Thanks for the Sample. Not allnis clear to ne but Problem scenario should manageable anyhow, But maybe ist alittle Bit Tricky. Can you Tell more about the Process. From where are coming the Data what is the Processing Goal. Thanks

Have tried For Each line of delivery Dte with statement in conditoins:
If stringWithDate.ToString.Contains(""\d{2}-[A-z]{3}-[0-9]{2}")=True

But jumps right to end of sequens

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