I'm getting a string such as
name1\r\nname2
how can I remove the \r\n and just have the string as
name1
name2? 6 2970
If you remove the new line characters. you're not going to get:
name1
name2
You'll get:
name1 name2
Is that what you want?
--
Regards,
Fred Chateau
fchateauAtComcastDotNet
"Steve" <St***@community.nospam.comwrote in message
news:ev**************@TK2MSFTNGP04.phx.gbl...
I'm getting a string such as
name1\r\nname2
how can I remove the \r\n and just have the string as
name1
name2?
well,
the thing is I need to pass each name into a method so I can get their
information.
here is what I have.
I have a textbox that a user can enter names in, its a multiline textbox and
they can enter the names in 2 ways,
1) all on one line and let the textbox wrap them
-- name1,name2,name3,name4,name5,
name6 and so on
2) or like this
name1
name2
name3
and so on
if they enter like #2 I need to take each name one by one and get their
information.
"Fred Chateau" <fc******@127.0.0.1wrote in message
news:uG**************@TK2MSFTNGP02.phx.gbl...
If you remove the new line characters. you're not going to get:
name1
name2
You'll get:
name1 name2
Is that what you want?
--
Regards,
Fred Chateau
fchateauAtComcastDotNet
"Steve" <St***@community.nospam.comwrote in message
news:ev**************@TK2MSFTNGP04.phx.gbl...
I'm getting a string such as
name1\r\nname2
how can I remove the \r\n and just have the string as
name1
name2?
Either way, I would use the Regex.Split() method in
System.Text.RegularExpressions.
--
Regards,
Fred Chateau
fchateauAtComcastDotNet
"Steve" <St***@community.nospam.comwrote in message
news:eE****************@TK2MSFTNGP02.phx.gbl...
well,
the thing is I need to pass each name into a method so I can get their
information.
here is what I have.
I have a textbox that a user can enter names in, its a multiline textbox
and they can enter the names in 2 ways,
1) all on one line and let the textbox wrap them
-- name1,name2,name3,name4,name5,
name6 and so on
2) or like this
name1
name2
name3
and so on
if they enter like #2 I need to take each name one by one and get their
information.
"Fred Chateau" <fc******@127.0.0.1wrote in message
news:uG**************@TK2MSFTNGP02.phx.gbl...
>If you remove the new line characters. you're not going to get:
name1 name2
You'll get:
name1 name2
Is that what you want?
-- Regards,
Fred Chateau fchateauAtComcastDotNet
"Steve" <St***@community.nospam.comwrote in message news:ev**************@TK2MSFTNGP04.phx.gbl... I'm getting a string such as
name1\r\nname2
how can I remove the \r\n and just have the string as
name1 name2?
Hello Steve,
You can use the split function of Strign to do this.
string[] names = inputString.Split(new char[]{',','\r','\n'}, StringSplitOptions.RemoveEmptyEntries)
Jesse
well,
the thing is I need to pass each name into a method so I can get their
information.
here is what I have.
I have a textbox that a user can enter names in, its a multiline
textbox and they can enter the names in 2 ways,
1) all on one line and let the textbox wrap them
-- name1,name2,name3,name4,name5,
name6 and so on
2) or like this
name1
name2
name3
and so on
if they enter like #2 I need to take each name one by one and get
their
information.
"Fred Chateau" <fc******@127.0.0.1wrote in message
news:uG**************@TK2MSFTNGP02.phx.gbl...
>If you remove the new line characters. you're not going to get:
name1 name2 You'll get:
name1 name2
Is that what you want?
-- Regards,
Fred Chateau fchateauAtComcastDotNet "Steve" <St***@community.nospam.comwrote in message news:ev**************@TK2MSFTNGP04.phx.gbl... I'm getting a string such as name1\r\nname2
how can I remove the \r\n and just have the string as
name1 name2?
OK, I'll have to take a look at that due to I never used it.
do you have an example?
"Fred Chateau" <fc******@127.0.0.1wrote in message
news:O5**************@TK2MSFTNGP02.phx.gbl...
Either way, I would use the Regex.Split() method in
System.Text.RegularExpressions.
--
Regards,
Fred Chateau
fchateauAtComcastDotNet
"Steve" <St***@community.nospam.comwrote in message
news:eE****************@TK2MSFTNGP02.phx.gbl...
>well, the thing is I need to pass each name into a method so I can get their information.
here is what I have.
I have a textbox that a user can enter names in, its a multiline textbox and they can enter the names in 2 ways,
1) all on one line and let the textbox wrap them -- name1,name2,name3,name4,name5, name6 and so on
2) or like this name1 name2 name3 and so on
if they enter like #2 I need to take each name one by one and get their information. "Fred Chateau" <fc******@127.0.0.1wrote in message news:uG**************@TK2MSFTNGP02.phx.gbl...
>>If you remove the new line characters. you're not going to get:
name1 name2
You'll get:
name1 name2
Is that what you want?
-- Regards,
Fred Chateau fchateauAtComcastDotNet
"Steve" <St***@community.nospam.comwrote in message news:ev**************@TK2MSFTNGP04.phx.gbl... I'm getting a string such as
name1\r\nname2
how can I remove the \r\n and just have the string as
name1 name2?
On Aug 3, 7:46 pm, "Steve" <St...@community.nospam.comwrote:
OK, I'll have to take a look at that due to I never used it.
do you have an example?
string input = "name1\r\nname2";
foreach(string s in Regex.Split(input,"\r\n"))
{
other_method(s);
}
More about Regex.Split http://msdn2.microsoft.com/en-us/lib...gex.split.aspx
Hope this helps This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: RiGGa |
last post by:
Hi,
I have a html file that I need to process and it contains text in this
format:
<TD><SPAN class=xf id=EmployeeNo
title="Employee Number">0123456</SPAN></TD></TR>
(Note split over two...
|
by: James Hu |
last post by:
This program is long. I don't really want to bore everyone with the
details, but it handles wierd cases like:
/\
* this is a comment *\
/
#define FOO ??/* this is not a comment */
char...
|
by: collinm |
last post by:
hi
here my code
FILE *fp;
char *line;
#define LINE_MAX 30
fp = fopen("test1.txt", "r");
|
by: kaushikshome |
last post by:
Can anyone please help me in writing the code in C++ :
I want a read a file line by line,remove the lines which have length of
a particular field in a line exceeding 63 characters After removing...
|
by: jacob navia |
last post by:
Recently, a heated debate started because of poor mr heathfield
was unable to compile a program with // comments.
Here is a utility for him, so that he can (at last) compile my
programs :-)
...
|
by: Frank Potter |
last post by:
I only want to remove the comments which begin with "//".
I did like this, but it doesn't work.
r=re.compile(ur"//+$", re.UNICODE|re.VERBOSE)
f=file.open("mycpp.cpp","r")
f=unicode(f,"utf8")...
|
by: afr02hrs |
last post by:
Hi Experts
I am trying to get the following program running correctly. I would like to be able to input a line of text containing multiple space characters between words and have the program...
|
by: LEM |
last post by:
Hi,
I'm trying to remove any empty lines from a string, and I am doing the
following:
String pp;
pp = "\r\n\r\n1\r\n23\r\n\r\n4";
pp = pp.Replace("\r\n\r\n", "\r\n");
|
by: coco09 |
last post by:
Hi all
I have the following line of text in my script
$var = do {local $/; <$FILE>};#<-- slurp whole file in scalar
The problem i am having is that the input file is a pcl file and has new...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
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...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
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...
|
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...
| |