Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jan 2000
Posts: 26
Member
Member
Offline
Joined: Jan 2000
Posts: 26
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]

Sponsored Links
Joined: Mar 2000
Posts: 4
Junior Member
Junior Member
Offline
Joined: Mar 2000
Posts: 4
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

Joined: Feb 1999
Posts: 1,379
cal Offline
Programmer
Programmer
Offline
Joined: Feb 1999
Posts: 1,379
Almost...

Code
code:

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

Just a thought [Linked Image]

Joined: Jan 2000
Posts: 26
Member
Member
Offline
Joined: Jan 2000
Posts: 26
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?

Joined: Feb 1999
Posts: 1,379
cal Offline
Programmer
Programmer
Offline
Joined: Feb 1999
Posts: 1,379
there are very few you really need.

n is new line
r is carriage return
t is tab

Just a thought [Linked Image]

Sponsored Links
Joined: Mar 2000
Posts: 4
Junior Member
Junior Member
Offline
Joined: Mar 2000
Posts: 4
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

Joined: Feb 1999
Posts: 1,379
cal Offline
Programmer
Programmer
Offline
Joined: Feb 1999
Posts: 1,379
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]

Joined: Jan 2000
Posts: 26
Member
Member
Offline
Joined: Jan 2000
Posts: 26
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?

Joined: Feb 1999
Posts: 1,379
cal Offline
Programmer
Programmer
Offline
Joined: Feb 1999
Posts: 1,379
$stuff = "one&two&three";
@array = split(/&/,$stuff);

Just a thought [Linked Image]

Joined: Jan 2000
Posts: 26
Member
Member
Offline
Joined: Jan 2000
Posts: 26
Thanks a lot Cal, you are da man!! [Linked Image]

Sponsored Links

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
hatter
hatter
USA
Posts: 69
Joined: January 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)