How to split a string array entry into two elements with first space as delimiter?

Hi all,

I’m trying to split every entry of a 1-d array of strings into a 2-d array, with the first space in the string as a delimiter.

The entries are as follows:

string[26]
{
“Pers.No.Employee/app.name”,
“70 Miss Beryl Broughton”,
“71 Mr. Harry Hill”,
“72 Miss Freda Fish”,
“73 Mr. Colman Mustard”,
“1000 Anja Müller”,
“1001 Michaela Maier”,
“1002 Dipl.Kfm. Ulrike Zaucker”,
“1003 Stefan Pfändili”,
“1004 Olaf Paulsen”,
“1005 Hanno Gutjahr”,
“1006 Jasmin Awad”,
“1007 Hanna Ulrich”,
“1008 Hilde Müller”,
“1009 Dr. Herbert Braunstein”,
“1010 Dipl.Kfm. Frank Schmidtrohr”,
“1011 Claudia Förster”,
“1012 Sabine Grundig”,
“1013 Wolfgang Humboldt”,
“1014 Gudrun Hintze”,
“1015 Alexander Rickes”,
“1016 Mike Kaufman”,
“1017 Annette Sturm”,
“1018 Bill Fischer”,
“1019 Keith Thomson”,
“1020 Beate Müller-Hinze”
}

I tried searching all over internet, but I’m still unable to do that.

Will the experts here please share how it can be achieved?

Thanks in advance for any help you can provide me with!

Cheers!
KG

Hi,
I do not know if such conversion could be achieved in single step.

For sure you could use Split method Split(separator,count) in For Each loop.

e.g. (“70 Miss Beryl Broughton”).Split({" "c},2) will return array of two elements {“70”,"Miss Beryl Broughton”}

Cheers

Hi,
Is it like for all the entries of the array, the values should split only for first space of each value in the array?

Regards,
Pavan H

@tkargee Can you elaborate more on this.Can you specify what is the input and expected output with example

As @J0ska said using split string - you can then add those items to your 2-d array.

1d Array to 2d Array.xaml (10.8 KB)
Attached is a method to convert 1d array to 2d array taking into account the length of the 1d array, probably not the most efficient way.

Hi all,

Thanks for all your suggestions. I was able to digest all your ideas, did further research on my own, and achieved what I intended to do.

Thanks!
KG

1 Like

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