By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,783 Members | 1,347 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,783 IT Pros & Developers. It's quick & easy.

String Relace

P: n/a
How do i Replace a character with a nul value

like this but this does not work
oNewString=oString.Replace('a','')
I Want to Replace a character with a NON Space

Thanks
DAve
Jan 28 '07 #1
Share this Question
Share on Google+
11 Replies


P: n/a
Realise that you are REMOVING the letter and not replacing it and all shall
be revealed on how to solve this problem ;)

"dave" <dv*****@sbcglobal.netwrote in message
news:88******************@newssvr29.news.prodigy.n et...
How do i Replace a character with a nul value

like this but this does not work
oNewString=oString.Replace('a','')
I Want to Replace a character with a NON Space

Thanks
DAve


Jan 28 '07 #2

P: n/a
Hi,

"dave" <dv*****@sbcglobal.netwrote in message
news:88******************@newssvr29.news.prodigy.n et...
How do i Replace a character with a nul value
What u meant with "null" ?

like this but this does not work
oNewString=oString.Replace('a','')
I Want to Replace a character with a NON Space
Your code does that, it replace 'a' with a NON space, more eactly it just
remove the 'a'

With what u want to replace it with?
Jan 28 '07 #3

P: n/a
Thanks Daniel...i Feel like a dummy......staring right in front of me.....

"Daniel" <no****@pokercat.co.ukwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Realise that you are REMOVING the letter and not replacing it and all
shall be revealed on how to solve this problem ;)

"dave" <dv*****@sbcglobal.netwrote in message
news:88******************@newssvr29.news.prodigy.n et...
>How do i Replace a character with a nul value

like this but this does not work
oNewString=oString.Replace('a','')
I Want to Replace a character with a NON Space

Thanks
DAve



Jan 28 '07 #4

P: n/a
like this but this does not work
oNewString=oString.Replace('a','')
I Want to Replace a character with a NON Space
oString.Remove('a')
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Jan 28 '07 #5

P: n/a
Remove works (as has been pointed out), but I frequently use Replace with
empty strings. I think it works with strings, but not chars....
Ethan
"dave" <dv*****@sbcglobal.netwrote in message
news:88******************@newssvr29.news.prodigy.n et...
How do i Replace a character with a nul value

like this but this does not work
oNewString=oString.Replace('a','')
I Want to Replace a character with a NON Space

Thanks
DAve


Jan 29 '07 #6

P: n/a
<"Ethan Strauss" <ethan dot strauss at Promega dot com>wrote:
Remove works (as has been pointed out), but I frequently use Replace with
empty strings. I think it works with strings, but not chars....
That's because there's no such thing as an "empty char".

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jan 29 '07 #7

P: n/a
code snippet

is the below the appropriate way to remove characters insid a sting or is
there a better solution

int iChr;

while ((iChr = oBufferOut.IndexOf('"'))>0)

{

oBufferOut=oBufferOut.Remove(iChr,1);

}

"dave" <dv*****@sbcglobal.netwrote in message
news:88******************@newssvr29.news.prodigy.n et...
How do i Replace a character with a nul value

like this but this does not work
oNewString=oString.Replace('a','')
I Want to Replace a character with a NON Space

Thanks
DAve


Feb 9 '07 #8

P: n/a
DaveP <dv*****@sbcglobal.netwrote:
code snippet

is the below the appropriate way to remove characters insid a sting or is
there a better solution

int iChr;

while ((iChr = oBufferOut.IndexOf('"'))>0)
{
oBufferOut=oBufferOut.Remove(iChr,1);
}
Yup - use oBufferOut.Replace ("\"", "");

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 9 '07 #9

P: n/a
Thank Jon
Dave

"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:MP************************@msnews.microsoft.c om...
DaveP <dv*****@sbcglobal.netwrote:
>code snippet

is the below the appropriate way to remove characters insid a sting or is
there a better solution

int iChr;

while ((iChr = oBufferOut.IndexOf('"'))>0)
{
oBufferOut=oBufferOut.Remove(iChr,1);
}

Yup - use oBufferOut.Replace ("\"", "");

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Feb 9 '07 #10

P: n/a
use
Replace(strString,'a','NULL')

regards

Apr 10 '07 #11

P: n/a
kshitij kumar <ks**********@discussions.microsoft.comwrote:
use
Replace(strString,'a','NULL')
Which language are you thinking of here? The above isn't valid C#, as
'NULL' isn't a valid character literal - and you'd want to call the
Replace method *on* strString, not with strString as the first
parameter.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Apr 10 '07 #12

This discussion thread is closed

Replies have been disabled for this discussion.