DeveloperCube - Get a newline character (\n) out of a string with Javascript
House M.D. fans unite at DrGregHouse.com
Username:    Password:
Remember Me?    
Get a newline character (\n) out of a string with Javascript

 
Post new topic   Reply to topic    DeveloperCube Forum Index -> Scripts and Programming
 See a User Guidelines violation? Please contact us.
Author Message

Pyrox

Joined: 10 Feb 2003
Posts: 158
Location: Blorp

PostPosted: 3/19/2003, 6:33 pm    Post subject: Get a newline character (\n) out of a string with Javascript Reply with quote

How do i get a newline character out of a string with javascript? If i pull the data from a text box and filter out all the newline characters and then put it back. Any thoughts???
ASAP PLEASE! Smile

Pyrox
_________________
Developercube Mod
Happiness is a belt-fed weapon
Consciousness: That annoying time between naps.
Out of my mind. Back in five minutes
Want a free ipod?
Back to top

axman

Joined: 07 Feb 2003
Posts: 160
Location: Wisconsin

PostPosted: 3/24/2003, 2:28 pm    Post subject: Reply with quote

See if there is an equivelant of the perl command chomp. which removes the trailing line feed.
_________________
Aaron Axelsen
DeveloperCube Forums Director
aaron@developercube.com
Back to top

Pyrox

Joined: 10 Feb 2003
Posts: 158
Location: Blorp

PostPosted: 3/24/2003, 5:09 pm    Post subject: Reply with quote

Ok, for all you guys out there... here is what i came up with to do the job. It's not javascript thought, it's now VBscript. OH well...

strComent=replace(IdentifierInformationTwo.value, vbcrlf, " ")
_________________
Developercube Mod
Happiness is a belt-fed weapon
Consciousness: That annoying time between naps.
Out of my mind. Back in five minutes
Want a free ipod?
Back to top

komputor

Joined: 10 Apr 2003
Posts: 17
Location: abita springs, la

PostPosted: 1/29/2004, 9:05 pm    Post subject: Reply with quote

here's one i cooked up long ago..

function trim(str) {
return( ("" + str).replace(/^\s+/,'').replace(/\s+$/,'') );
}
Back to top

Paul

Joined: 18 Jan 2004
Posts: 137
Location: Worthing, UK

PostPosted: 1/29/2004, 9:14 pm    Post subject: Reply with quote

Quote:
strComent=replace(IdentifierInformationTwo.value, vbcrlf, " ")


And if you want the direct javascript equivalent, I think it is:

strComent = IdentifierInformatioTwo.value.replace("\n", " ");

Smile
_________________
Paul Woodland - DeveloperCube Moderator
LiquidSix Hosting: Windows 2003 Plans from £9.95 / $18 for a year
PW New Media Network / Forums
Back to top

Pyrox

Joined: 10 Feb 2003
Posts: 158
Location: Blorp

PostPosted: 1/30/2004, 10:27 pm    Post subject: Reply with quote

Wow... yea, that was a while back.... dont' even remember the point of posting this... hmmm.... Very Happy
Thanks anyways!
Pyrox
_________________
Developercube Mod
Happiness is a belt-fed weapon
Consciousness: That annoying time between naps.
Out of my mind. Back in five minutes
Want a free ipod?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    DeveloperCube Forum Index -> Scripts and Programming All times are GMT
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Links: Programming Forum - Art Schools Online

Network: iFroggy Network Blog - iFroggy Hosting - SportsForums.net - KarateForums.com - YanksBlog.com - phpBBHacks.com - PhotoshopForums.com - Managing Online Forums - ManagingCommunities.com - CommunityAdmins.com - DrGregHouse.com - Bad Boy Blog - SodaRatings.com - Patrick O'Keefe

We Support phpBBHacks.com. Forum Icons by Daz. Privacy Policy. Powered by phpBB © phpBB Group. phpBB SEO.
Copyright © 2003-2009. DeveloperCube, iFroggy Network. All Rights Reserved.

Advertising   Contact   Links   Link To Us   Staff   User Guidelines