Removing extra commas from string after using String.Join to convert array to string (C#) -
quick question here. i'm converting array string using string.join. small issue have that, in array index positions blank. example below:
array[1] = "firstcolumn" array[3] = "thirdcolumn"
by using string.join(",", array);, i'll following:
firstcolumn,,thirdcolumn
note ,. how can remove commas string, or ideally not include blank indices when using string.join?
try :):
var res = string.join(",", array.where(s => !string.isnullorempty(s)));
this join strings not null
or ""
.
Comments
Post a Comment