Generating a .CSV file

I am trying to generate a .csv file using GP Script. I want the resulting file to look like this:

Hello, A,B,C
GoodBye, D,E,F

In order to generate this I need to insert a CRLF at the end of each line. I tried this, but it didn’t work:

    Success : Boolean
    BigString : String = ""
BigString = "PRESET,1,2,3" + IntToHexString(13)
BigString = BigString + "Hello, A,B,C"  + IntToHexString(13)
BigString = BigString + "GoodBye, D,E,F" +  IntToHexString(13)
Success = SaveStringToTextFile ("BigString.csv", BigString) 

If Success Then

The code worked fine but I didn’t get the CRLF at the end of each line?

The IntToHexString(13) converts a number into a hex string (per the function name) and so you will probably get something like

PRESET,1,2,30dHello… (note that 0d)

That said, I can see how the help message for that function makes it look like it could return and actual ASCII character (I’ll change that)

However, to fix your problem, just create an end of line character as follows:

   EOL : String = <<<

Now you can just write

BigString = "PRESET,1,2,3" + EOL
BigString = BigString + "Hello, A,B,C"  + EOL
BigString = BigString + "GoodBye, D,E,F" +  EOL

and that should give you what you need