From array of items i need to remove last comma

Hi

I have an array of string variable where the data in it contains like below

ItemArray={024-0022-004,1001-000,1001-0002,1002-101,1002-513,1023-000,1023-001,1023-021,1023-033,1023-039,1023-050,1023-057,1023-065,1023-096,1023-113,1023-125,1023-132,1023-137,1023-160,1023-177,1023-191,1023-198,1023-201,1023-210,1023-222,1023-229,1023-256,1023-282,1023-287,1023-320,1023-383,1050-472,1054-270,1059-102,1059-103,1060-008,1061-103,1061-472,1067-830,1067-834,1069-330,1081-273,1081-470,1081-471,1081-474,1081-476,1081-494,1081-496,1081-497,}

in the above array i need to remove last comma which is after 1081-497

Thanks in advance
Likitha

Hi @vinjam_likitha ,

Is this an Array type data or a String type ?

An Array item I believe would not have the comma in that format, it must always be ending with a Data item.

HI @vinjam_likitha

Check this Expresion

ArrayVariable.AsEnumerable().Where(Function(a) Not String.IsNullOrEmpty(a.ToString) or Not String.IsNullOrWhiteSpace(a.ToString)).Toarray

Regards
Sudharsan

Hi

Sorry yes its a string variable

@vinjam_likitha ,

In that case, maybe just try with the Trim like below :

ItemArray.Trim(",".ToCharArray)

Also let us know if { } are part of the string

@vinjam_likitha

Check below for your reference

use ItemArray.TrimEnd(","c)

Hope this may help you

Thanks,
Srini

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