I am gettting this pattern

i am gettting this pattern want only the number other than 0 how to get
str = 1,1,1,1,0 what i need is str = 1,1,1,1
str = 0,1,0,0,0 str = 1

how to get this

we can extract with Regex:

or on string base

1 Like


Another solution:

String.Join(",",yourString.Split(","c).Where(Function(s) s<>"0"))

This will work even if there is 2 digits number such as 10.


1 Like

please share it with us (also feel free to show us some more details on your imp) Thanks

this is what i am getting

you ommited the seperator character argument part
String.Join( ",",values.....

is it ok

Please read / check carefully
String.Join(",",values.Replace("0","").Where(Function(x) Char.IsDigit(x)))

we assume values is your variablename

1 Like