C removes the last closing comma

  • 2021-01-18 06:36:58
  • OfStack

This example shows how C# removes the last trailing comma. Share with you for your reference. The specific implementation method is as follows:

This function is used to remove the last comma from an array or list of strings. This function is used to remove the last comma.


/// <summary>
///  Delete the last ending 1 A comma 
/// </summary>
public static string DelLastComma(string str)
{
  return str.Substring(0, str.LastIndexOf(","));
}

I hope this article is helpful to your C# program design.


Related articles: