Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# list to string replace last comma with and

        var test = "Service Control Manager repeated 5 times, Microsoft-Windows-DistributedCOM repeated 2 times, Control Manager repeated 6 times.";
        var lastComma = test.LastIndexOf(',');
        if (lastComma != -1) test = test.Remove(lastComma, 1).Insert(lastComma, " and");
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #list #string #replace #comma
ADD COMMENT
Topic
Name
7+3 =