473,382 Members | 1,635 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 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 4678
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 separate them by carriage returns/ Line feeds? ...
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. Also, are they any great references for learning...
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 to remove all trailing CrLf's and convert all...
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 no luck! I even poked around in the MSDN and...
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 designing to speed up the work on my latest project. ...
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 strings being captured. However i do not want my...
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 line feeds. For all I know, this happens on...
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 carriage return linefeeds, so I need to figure out how...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.