Page 1 of 1
Carriage Return Line Feed
Posted: Mon Jan 18, 2010 11:09 pm
by Brian Walsh
I want to append a carriage return (ASCII 13) and line feed (ASCII 10) to a string.
My variable is as follows:
string = "hello world"
Could someone please show me the syntax to add the two control characters.
Brian.
Re: Carriage Return Line Feed
Posted: Mon Jan 18, 2010 11:43 pm
by Sean
Hello Brian,
One way to add carriage return and line feed to a string is to make a string containing only these characters, and add it to any other string as required. This process allows Flowcode to maintain correct control of the lengths of the strings involved.
First, use a string block to create a string called CrLf and initialise it with a 2 character string, eg. "xx".
Next, use a calculation block to access the string as an array and change the two characters to the unprintable CR and LF values:
CrLf[0] = 0x0d
CrLf[1] = 0x0a
The CrLf string can then be used in Flowcode string blocks to add the characters to other strings.