473,378 Members | 1,321 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,378 software developers and data experts.

Taking away a text from a string

Hello!
I just asked a question, but it seems my question wasn't clear enough, so
I'll ask again, simply.

How can I take the LAST text (say "\r\n") from a string value??

So, if
string a="Hello!\r\nHow are you?\r\n";
it would become
a="Hello!\r\nHow are you?";

Thank you in advance!

Nov 15 '05 #1
2 1127
As Jon said, with SubString()

string line = "something\r\n";
line = line.Substring(0, line.Length - 2);

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
For a laugh, try web browsing with Opera's User Mode and Nostalgia enabled
Nov 15 '05 #2
n!
> string a="Hello!\r\nHow are you?\r\n";
it would become
a="Hello!\r\nHow are you?";


You can use the 'TrimEnd' method:

string a="Hello!\r\nHow are you?\r\n";

a= a.TrimEnd( '\r', '\n' );

n!
Nov 15 '05 #3

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

Similar topics

4
by: Tomomichi Amano | last post by:
Hello! I am making a program where it reads out a TXT file like this... string line=sr.ReadLine(); textBox1.Text+=line += "\r\n"; The problem with this code is that, each time it loads a...
2
by: Claire Streb | last post by:
Dear Microsoft, You make some great products, really, but I have a request: Please stop taking away functionality from your users. 1) In Visual Studio 6, we had two output folders, Debug and...
1
by: Michael D. Reed | last post by:
I am using the help class to display a simple help file. I generated the help file using Word and saving it as a single page Web page (.mht extension). I show the help file with the following...
2
by: Brian Kitt | last post by:
I have a process where I do some minimal reformating on a TAB delimited document to prepare for DTS load. This process has been running fine, but I recently made a change. I have a Full Text...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: 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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.