472,969 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

.replace of extra line feeds

Hello.

I just converted some data to to sql2000 into a TEXT type field. I
needed to remove all tabs from the data and now want to remove extra
lines too.
As we know, SQL2000's replace function does not work on TEXT types. So
I've written a simple asp.net program (with very high timeouts) that
allows me to replace strings in these very large Text fields. I loop
through the table and am able to replace any strings I want except I
can't seem to figure out how to replace extra blank lines with a
single line feed and carriage return.

Comparing the old data to the new data. I see I have extra hex values
between lines of

old = 0D0A
new = 0D0A0D0A

so I'm looking to replace 0D0A0D0A with 0D0A.

Here's the asp.net (VB) I have tried. None yeild the change:

dim thebody as string
thebody=thebody.replace(chr(13)+chr(10)+chr(13)+ch r(10),chr(13)+chr(10))
thebody=thebody.replace(chr(13)&chr(10)&chr(13)&ch r(10),chr(13)&chr(10))
thebody=thebody.replace(vbCrLf&vbCrLf,vbCrLf)

Again, the same logic does replace any other string including Tab =
chr(9)

Thanks for any help or info!
Nov 17 '05 #1
2 3817
did you try Environment.NewLine?

If you try ret=thebody.IndexOf(vbcrlf) or chr(13) chr(10) do you
get a value greater then -1 in the string?

If in worst case you can try looping throught the string substring or
miding the results together.

Mike
ja***@cyberpine.com wrote in message news:<ef**************************@posting.google. com>...
Hello.

I just converted some data to to sql2000 into a TEXT type field. I
needed to remove all tabs from the data and now want to remove extra
lines too.
As we know, SQL2000's replace function does not work on TEXT types. So
I've written a simple asp.net program (with very high timeouts) that
allows me to replace strings in these very large Text fields. I loop
through the table and am able to replace any strings I want except I
can't seem to figure out how to replace extra blank lines with a
single line feed and carriage return.

Comparing the old data to the new data. I see I have extra hex values
between lines of

old = 0D0A
new = 0D0A0D0A

so I'm looking to replace 0D0A0D0A with 0D0A.

Here's the asp.net (VB) I have tried. None yeild the change:

dim thebody as string
thebody=thebody.replace(chr(13)+chr(10)+chr(13)+ch r(10),chr(13)+chr(10))
thebody=thebody.replace(chr(13)&chr(10)&chr(13)&ch r(10),chr(13)&chr(10))
thebody=thebody.replace(vbCrLf&vbCrLf,vbCrLf)

Again, the same logic does replace any other string including Tab =
chr(9)

Thanks for any help or info!

Nov 17 '05 #2
mi**@high-pow-er.com (Michael Evanchik) wrote in message news:<36**************************@posting.google. com>...
did you try Environment.NewLine?

If you try ret=thebody.IndexOf(vbcrlf) or chr(13) chr(10) do you
get a value greater then -1 in the string


Thanks for response.

I did not, but that actually would have uncovered my problem. After
posting I did a select in sql2000 QA and found that either asp.net or
the html textbox was adding a chr(10)=Line Feed between consecutive
chr(13)s=Carriage Returns Only in the textbox, not found in the DB.
So, I was able to fix my Text type fields by preplacing
chr(13)&chr(13) to "".

I've seen a number of posts listing very long and complicated SQL2000
stored procs to performing what should be a simple text string
replace. ASP.NET seems to be a simple way around the problem!
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: DaveJG | last post by:
I have a couple of questions involving the search/replace in the IDE and regular expressions. Any help would be greatly appreciated. 1. How would I replace two line feeds with one? That is ...
6
by: Marty | last post by:
Hi, I would like to replace "\r\n" by "_" within a specific string. I tried : strMyString.Replace('\r', '_'); strMyString.Replace('\n', '_'); or...
1
by: Frank Esser | last post by:
Hello, I read data from a DB field where a line feed ("\n") is in. I put this data as text to a label web control. In the HTML page the line feeds are shown as real line feeds in the HTML...
3
by: John K | last post by:
I'm new to PHP and come from and ASP background... I want to replace line feeds in user submited textareas with <br> or <p> or <div>. In ASP I do this to replace carriage return/line feeds with...
4
by: jgabbai | last post by:
Hi, What is the best way to white list a set of allowable characters using regex or replace? I understand it is safer to whitelist than to blacklist, but am not sure how to go about it. Many...
13
by: CK | last post by:
Hi all, I have a textarea control. I am putting it's value in an html email. The problem is that the new lines are being ignored. I want to take the controls value and replace any newline...
6
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello, I have some XML that is returned to my application from another vendor that I cannot change before it gets to me. I can only alter it after it gets to my application. That being said, I...
8
by: Kurt Peters | last post by:
I'm using the code below to read a pdf document, and it has no line feeds or carriage returns in the imported text. I'm therefore trying to just replace the symbol that looks like it would be an...
2
by: tom0550 | last post by:
Around December 2008 our MS Access 2003 application started inserting extra line feeds everytime the RTF edit window was opened and saved. It was working fine up to that time. We are using the MS...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.