Hello, I have sample string builder by append different values " ," comma separated.
Eg. Items: Apple,Orange, I need to remove at last index “,” which is after orange. Can anyone suggest the solution?
Thanks
Hello, I have sample string builder by append different values " ," comma separated.
Eg. Items: Apple,Orange, I need to remove at last index “,” which is after orange. Can anyone suggest the solution?
Thanks
string builder does not have TrimEnd method.
Maybe Conversion to string and then reconvert back to StringBuilder :
new StringBuilder(YourStringBuilderVar.ToString.TrimEnd(",".ToCharArray))
Hi,
In this case, perhaps we should use string which is converted from StringBuilder.
Can you check the following MS official document - The String and StringBuilder types section.
Hope this helps you.
Regards,
but, this is has been removing all the " ," occurrences.
Could you show us what have you tried ?
If you can maybe provide us a Screenshot of the usage/implementation like provided above, it would help us understand what was the issue.
Items = Open,Closed,
Items = new StringBuilder(Items.ToString.TrimEnd(“,”.ToCharArray))
this is what I have tried , but got Items= OpenClosed as output
I think I was able to get the right output :