Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Remove newline character from a string

Posted on 2008-06-09
3
Medium Priority
?
1,886 Views
Last Modified: 2011-10-19
See the attached file. It contain the string that i wish to parse out. The block you see in front of Sr.Manager in the attached file, i the problem . I am not sure if it is a newline character or not since i used various replace functions and it did not work.

Replace(strRip, vbNewLine, "", , , vbTextCompare)
Replace(strRip, vbNewLine, vbNullString)
Replace("\n", ")
newline.txt
0
Comment
Question by:TECH_NET
3 Comments
 
LVL 18

Accepted Solution

by:
ChetOS82 earned 600 total points
ID: 21745499
vbNewLine is only LF.  You need to replace CR and LF.  I couldn't get it to work with vbCrLf, so I broke it up into to operations:

strRip = strRip.Replace(vbCr, "")
strRip = strRip.Replace(vbLf, "")

Also note that there are some tabs in there, you can use vbTab if you want to remove that as well.
0
 
LVL 2

Expert Comment

by:rbmyoung
ID: 21745566
You could also try replacing Chr(13):
strRip = strRip.Replace(Chr(13), "")

But that may not get you exactly where you want to be as it looks like you have tabs as well.
0
 
LVL 7

Assisted Solution

by:ydramu
ydramu earned 400 total points
ID: 21745665
http://www.experts-exchange.com/Programming/Languages/SQL_Syntax/Q_23406187.html

The above url is for SQL.

But for VB.NET.

strValue = strValue.Replace(vbCrLf, String.Empty)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question