User bio

IT Jack of all trades, developing and maintaining Mumps/Intersystems systems since the 90's.

Member since Apr 27, 2021
Posts:
Replies:

Just realised this is an old(ish) post but it has had a recent response so I'll still add the below FWIW...

This is nice an simple but be aware it doesn't handle commas, or other potentially problematic characters, in a string value.

CSV requires that any value containing quotes or the delimiter (comma) should be quoted, anything that reads in CSV should handle this.

Given an example "one,2,three,4" your example works but """one,"",2,three,4"  will not, it will create a list with 5 parts.

set line = """one,"",2,three,4"
set fields = $ListFromString(line, ",")
for n = 1:1:$listlength(fields) w !,$list(fields,n)

"one
"
2
three
4

The %SQL.Util.Procedures class has some useful CSV methods or take a look at CSVGEN.
 

Open Exchange applications:
Certifications & Credly badges:
David has no Certifications & Credly badges yet.
Followers:
Following:
David has not followed anybody yet.