markvax
(Mark)
1
Hi there.
I am trying to do a concatenation of strings with a separator on the condition the string element is not empty. if it is, skip it.
I found some references to a C# code looking like this
var1 = string.Join(“,”, s_array.Where(s => !string.IsNullOrEmpty(s)))
where var1 is a string datatype and S_array is an array of strings.
Any ideas other than looping through the array? I want a quick and short assign activity.
Thanks.
Mark
loginerror
(Maciej Kuźmicz)
2
Hi @markvax
Just to close this topic:
- nowadays, you could use the C# project and use your code as is
OR
- use this snipped for the vb.net project:
string.Join(",", variable1.Where(function(s) not String.IsNullOrEmpty(s)))
1 Like
markvax
(Mark)
3
Hi Maciej,
Thanks for providing the code snippet. Its been 3 years and I forgot what i needed it for:)
I’ll keep it handy in my cheat sheet for future use.
Regards,
Mark
1 Like