On 21 Jan 2011, at 12:37, Lisa Pollard wrote:
> 4D v11.8 & Active 4D v5.0r17
>
> I am having a problem when saving information which includes CRs & LFs
> entered in the browser (same results in Safari 5.0.3 & Firefox 3.6.13). The
> CR and LF characters cannot be seen by the Position and Replace String
> commands.
>
> Here's the test script I am working on (where $text replicates the value of
> the textarea form variable):
>
>
> $text:="one"+char(13)+char(10)+"two"+char(13)+char(10)+"three"
> WRITE TO CONSOLE("test,1: = "+$text)
> WRITE TO CONSOLE("test,2: length of text = "+length($text))
> WRITE TO CONSOLE("test,3: ascii4 = "+ascii(substring($text;4;1)))
> WRITE TO CONSOLE("test,4: ascii5 = "+ascii(substring($text;5;1)))
> $length:=0
> $pos:=position(char(13);$text;1;$length;*)
> WRITE TO CONSOLE("test,5: position 13 = "+$pos)
>
> $text:=replace string($text;char(13);"CR";*)
> $text:=replace string($text;char(10);"LF";*)
>
> WRITE TO CONSOLE("test,6: = "+$text)
Just to reiterate, that this works in 4D v11 but not in A4D v5.0r17.
Further to my previous emails I have since discovered that if I put the CR & LF
in a variable first, Position and Replace String happily work!
$Text:="one"+char(13)+char(10)+"two"+char(13)+char(10)+"three"$test:=char(13)+char(10)
$test:=char(13)+char(10)
$pos:=position($test;$Text)
$text:=replace string($Text;$test;"CRLF")
WRITE TO CONSOLE("test,6: = "+$Text)
Result in the console is:
test,6: = oneCRLFtwoCRLFthree
This doesn't work if I just put the CR in the variable ($test:=char(13))
cheers
Lisa
--
Lisa Pollard
Software Developer
Another Dimension Ltd
Needham Hall Barns, Needham Street
Gazeley, Newmarket, Suffolk. CB8 8RR
[email protected]
Tel: +44 1638 554450
URL: http://www.anotherdimension.co.uk
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/