Marco
2 years agoContributor II
Data cell ends with a comma
Hi Everyone. I have a DataCell that ends with a comma, and I wanted to know how I can remove it.
Example
Etc.
UD6Id: -999,
UD7Id: -999,
UD8Id: -999,
My issue is similar to the example, wher...
- 2 years ago
Hi Marco,
It would help if you post the code that is producing this. I'm going to assume you need to remove the last comma that is added using a loop that puts a comma at the end of a string on each iteration. To resolve the extra comma that results, you can add(use whatever variable name you are using now for "strDataCellMembers"):
strDataCellMembers = strDataCellMembers.TrimEnd(",", c)
Often a better approach is to create a List(Of String) and add the datacell member scripts to the list in your loop. Then add the commas like this:
Dim strDataCell As String = String.Join(",", lstDataCellElements)
This approach eliminates the need to manage the last extra comma that looping and appending a string or stringbuilder has.