Dołącz ostatni element JavaScript tablicy o innej wartości
['tom', 'dick', 'harry'].join(', ').replace(/, ([^,]*)$/, ' and $1')
> "tom, dick and harry"
Enchanting Eagle
['tom', 'dick', 'harry'].join(', ').replace(/, ([^,]*)$/, ' and $1')
> "tom, dick and harry"
List<string> names = new List<string>() { "John", "Anna", "Monica" };
var result = String.Join(", ", names.ToArray());
var combined = String.Join(",", new String[]{"a","b"});
// a,b
Array.join()
String.join(" - ", "This", "course", "is", "awesome");
String.valueOf(22); // retourne "22"