UBB.Dev
Posted By: RangerRob How do the make the RETURN key return? - 04/26/2000 4:53 PM
I have been playing around with perl for a qhile now and one of the things I love about the UBB which so far I have been unable to figure out is how do UBB make it so that when the RETURN key is pressed it shows the new line in the final post?
Basically what happens when I try this is I put up an input box and whilst it all looks great in there, when it comes to viewing the post all the words are wrapped one the same line (i.e. the return paragraphing has been cancelled out).
Does anybody know how to fix this?

Thanks in advance. [Linked Image]
Posted By: MC_Mouse Re: How do the make the RETURN key return? - 04/26/2000 5:12 PM
When something is sent from a text box, the enter that was pressed is actually sent as an escape code: r (and n is new line)

to change these into html br's, try this:
Code
code:

you may wish to do the same for n.

(someone correct me if i messed up the code, been doing too much VB these days)

-MC_Mouse
Posted By: cal Re: How do the make the RETURN key return? - 04/26/2000 5:33 PM
Almost...

Code
code:

Not all system generate r so use n and delete all r.

Just a thought [Linked Image]
Posted By: RangerRob Re: How do the make the RETURN key return? - 04/26/2000 9:21 PM
Thanks a lot guys for some reason no matter how much perl I do the one thing that I can never get the hang of is all the string handling (i.e. escape functions).
Do any of you have a good way (i.e. a tactic) to remember what they all mean?
Posted By: cal Re: How do the make the RETURN key return? - 04/26/2000 9:25 PM
there are very few you really need.

n is new line
r is carriage return
t is tab

Just a thought [Linked Image]
Posted By: MC_Mouse Re: How do the make the RETURN key return? - 04/26/2000 9:44 PM
I use the book "Programming perl" it remembers FOR me. smile (of course, i don't have it here -- doh)

but, perl.com has all that wonderful stuff too.

cal: is there any characteristical difference between n and r? Also, is there any real use for the s switch? i always use it just to be sure my var is taken as a string.

-MC_Mouse
Posted By: cal Re: How do the make the RETURN key return? - 04/27/2000 11:26 AM
Is is supposed to mean "Treat input as a single line". I think you use it without g to replace once per line.

n = character 10
r = character 13

Windows generates 13-10 sequences, unix does 10 and MacOs does 10-11 (or something stupid)

Just a thought [Linked Image]
Posted By: RangerRob Re: How do the make the RETURN key return? - 04/28/2000 12:16 PM
Thanks again for your help with my original problem guys, I have another question on the same sort of thing though...
How can I make it so that another character is a deliminator acting as a string splitter?

So, i.e. How could I make it so that the string "11AB&22AB&33AB" can become three strings "11AB", "22AB", "33AB", using the "&" part of the original string as a splitter to determine the seperations required?
Posted By: cal Re: How do the make the RETURN key return? - 04/28/2000 12:32 PM
$stuff = "one&two&three";
@array = split(/&/,$stuff);

Just a thought [Linked Image]
Posted By: RangerRob Re: How do the make the RETURN key return? - 04/28/2000 4:42 PM
Thanks a lot Cal, you are da man!! [Linked Image]
© UBB.Developers