Re: Printing numbers

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi Sid,
>
>I want to take a sequence of integers and turn it into a .csv file - ie a
>text file with the numbers as numbers, with commas in between (and maybe
>semicolons for line delimiters). No braces or anything, just numbers.
>

Here is one way of doing this...

    sequence NumberList
    integer FldDelim, LineDelim, Delim

    FldDelim = ','
    LineDelim = ';'
    for i = 1 to length(NumberList) do
       if i != length(NumberList) then
            Delim = FldDelim
       else
            Delim = LineDelim
       end if
       printf(file, "%d%s", {NumberList[i]), Delim})
    end for

-----
cheers,
Derek Parnell

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu