472,337 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,337 software developers and data experts.

How to Remove Carriage return and line feeds.

Hi.

I have form that has a text box. I want insert unformatted text into the database.
Even if the user gives an carriage return or New line feed in the database it should be stored as on single line without any formatting.

I just want to remove
New Line Feed(\n)
Carriage Return(\r)
spaces at the begin and end of the string.

Eg:
If i have
text1(enter key pressed)
text2(enter key pressed)
text3(enter key pressed)
Blank space
Blank space

I want this to be stored in the DB as:
text1 text2 text3

Could someone help me with this?

Thanks
Apr 7 '08 #1
4 4582
ronverdonk
4,258 Expert 4TB
For removing characters you can use the str_replace() command.

We can help you when you start writing your own code. Then come back here when you run into problems or have questions. We do not supply ready made code.

Ronald
Apr 7 '08 #2
I already have the code ,Everything works fine but i want to store the data from a textarea without any formatting into the database.

Currrently it stores data with formatting like (\n)(\r)
i want to strip them off. and use one single line with spaces between words.

i used str_replace() but that does not seem to work.

Can someone helpme with this.

Thanks
Apr 7 '08 #3
aktar
105 100+
Try str_replace() with ascii codes
Apr 7 '08 #4
ronverdonk
4,258 Expert 4TB
Show your str_replace command here. I wonder if you defined the \n and \r within single quotes. When you did: that does not work. You have to include them within double quotes.

Show your str_replace() command anyway (within code tags)

Ronald
Apr 7 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: | last post by:
Hi, I want to send an Email using ASP (I know how to to this) The body of the Email contains several variabels How do I concat string values and...
4
by: McKirahan | last post by:
How would I use a regular expression to remove all trailing Carriage Returns and Line Feeds (%0D%0A) from a textarea's value? Thanks in advance. ...
5
by: McKirahan | last post by:
I'd like to use regular expressions to remove extraneous Carriage Return Line Feeds (CrLf) from a textarea before the form is submitted. I'd like...
6
by: Laura D | last post by:
How can I identify a carriage return in C++? \r, \f, \0, \n, \t does not work. I have also tried !isprint(ch), iscntrl(ch), isspace(ch), etc....with...
2
by: Lila Godel | last post by:
I am having a problem with the download of web pages via the WebClient.DownloadFile function in the specialized VB.Net 2003 I.E. plug-in I am...
2
by: James | last post by:
below is some codes. my arraylist below reads from a file. My files contains blank line (ie carriage return) My message dialog shows all...
0
by: ajfish | last post by:
Hi, I've noticed that if a return value from a web service is a string, any carriage return/line feed pairs in that string get converted to plain...
0
by: J.Marsch | last post by:
I am having a problem in which ASP.Net web services are corrupting my data. I know that my problem is related to the standard way of encoding...
5
by: vflyer | last post by:
I there a quick routine that removes trailing newline chars and carriage return? vFlyer Labs http://www.vflyerlabs.com
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.