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
J0ska
March 4, 2019, 1:34pm
2
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.
c#
e.g. (“70 Miss Beryl Broughton”).Split({" "c},2) will return array of two elements {“70”,"Miss Beryl Broughton”}
Cheers
pavanh003
(Pavan Harisha)
March 4, 2019, 1:42pm
3
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
indra
(Indra)
March 4, 2019, 2:12pm
4
@tkargee Can you elaborate more on this.Can you specify what is the input and expected output with example
TimK
(Tim Kok)
March 4, 2019, 3:16pm
5
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
system
(system)
Closed
March 8, 2019, 11:13am
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.