There are many solutions to this. I immediately can think of
- use a regex to replace the last comma by nothing
- use substr to extract the first stringlength - 1 letters
- do some logic not to write the last comma at all (e.g. write it before the key/value-pair - except for the first time)
HTH, Rata