How to remove character from string
-
Why write a rude reply to someone who also tries to help out just because the answer is almost the same? Obviously I had not seen your reply when I wrote mine.. and really, what is your problem? :wtf:
Calla wrote:
Obviously I had not seen your reply when I wrote mine
You would say that, wouldn't you?
Calla wrote:
and really, what is your problem?
You! :-) Okay, okay, sorry - bit pissed because it happen more than it used to: seems like people just trying to get rep points for no good reason.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
-
Calla wrote:
Obviously I had not seen your reply when I wrote mine
You would say that, wouldn't you?
Calla wrote:
and really, what is your problem?
You! :-) Okay, okay, sorry - bit pissed because it happen more than it used to: seems like people just trying to get rep points for no good reason.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
digital man wrote:
You would say that, wouldn't you?
Like J4amieC wrote: They were 3 minutes apart dude...
digital man wrote:
Okay, okay, sorry - bit pissed because it happen more than it used to: seems like people just trying to get rep points for no good reason.
Yes.. getting rep points is really what life is all about, isn't it? ;)
-
digital man wrote:
You would say that, wouldn't you?
Like J4amieC wrote: They were 3 minutes apart dude...
digital man wrote:
Okay, okay, sorry - bit pissed because it happen more than it used to: seems like people just trying to get rep points for no good reason.
Yes.. getting rep points is really what life is all about, isn't it? ;)
Calla wrote:
Like J4amieC wrote: They were 3 minutes apart dude...
That's a lifetime.
Calla wrote:
Yes.. getting rep points is really what life is all about, isn't it?
For me, no, for you... I think there are people here who see them as important though I can't see why.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
-
If someone has already answered why post exactly the same answer??? :mad:
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
I've occassionally done this when I've come to one of the forums, got distracted by a task (having possibly started an answer off), and not refreshed the browser. It has nothing to do with attempting to gain rep points (I don't really need to boost mine), and more to do with timing.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
Hi, Kindly let me know, How may I remove character from string value? Example: string strValue = "AP.P.LE"; // "APPLE" I want to remove dots only Thank you (Riaz)
-
Hi, Kindly let me know, How may I remove character from string value? Example: string strValue = "AP.P.LE"; // "APPLE" I want to remove dots only Thank you (Riaz)
Hi Riaz, you can remove "." from a given string from the following ways: 1) Simple way :
string strValue = "This. is .test .string. that. removes the (DOT) from the. string";
strValue = strValue.Replace(".",string.Empty);- REGEX WAY :
string strValue = "This. is .test .string. that. removes the (DOT) from the. string";
strValue = System.Text.RegularExpressions.Regex.Replace(strValue, @"\.+", "");please check the value of strValue ( you find that "." is removed from the given string ) 3) Through Loop and replace characters: Here for simplicity I have made a static function that will take input as a string and returns a string by replacing "." NOTE :- To Remove all special characters including white space from the given string just uncomment the first line in below function.
public static string RemoveSpecialChars(string str)
{
//string[] chars = new string[] { ",", ".", "/", "!", "@", "#", "$", "%", "^", "&", "*", "'", "\"", ";", "-", "_", "(", ")", ":", "|", "[", "]", " " };
string[] chars = new string[] { "." };
for (int i = 0; i < chars.Length; i++)
{
if (str.Contains(chars[i]))
{
str = str.Replace(chars[i], "");
}
}
return str;
}Now use this function anywhere to remove "." from input string . Please check below example for how to use :
string strValue = "This. is .test .string. that. removes the (DOT) from the. string";
strValue = RemoveSpecialChars(strValue );please check the value of strValue ( you find that "." is removed from the given string ) Note :- If your purpose is to remove "." only from a given string then Simple Way is better.But If you want special characters to be removed from string then you either need REGEX or Through Loop and replace characters. For REGEX you have to find the REGEX to remove special characters. Thanks, Nilesh Upadhyay
-
Hi Riaz, you can remove "." from a given string from the following ways: 1) Simple way :
string strValue = "This. is .test .string. that. removes the (DOT) from the. string";
strValue = strValue.Replace(".",string.Empty);- REGEX WAY :
string strValue = "This. is .test .string. that. removes the (DOT) from the. string";
strValue = System.Text.RegularExpressions.Regex.Replace(strValue, @"\.+", "");please check the value of strValue ( you find that "." is removed from the given string ) 3) Through Loop and replace characters: Here for simplicity I have made a static function that will take input as a string and returns a string by replacing "." NOTE :- To Remove all special characters including white space from the given string just uncomment the first line in below function.
public static string RemoveSpecialChars(string str)
{
//string[] chars = new string[] { ",", ".", "/", "!", "@", "#", "$", "%", "^", "&", "*", "'", "\"", ";", "-", "_", "(", ")", ":", "|", "[", "]", " " };
string[] chars = new string[] { "." };
for (int i = 0; i < chars.Length; i++)
{
if (str.Contains(chars[i]))
{
str = str.Replace(chars[i], "");
}
}
return str;
}Now use this function anywhere to remove "." from input string . Please check below example for how to use :
string strValue = "This. is .test .string. that. removes the (DOT) from the. string";
strValue = RemoveSpecialChars(strValue );please check the value of strValue ( you find that "." is removed from the given string ) Note :- If your purpose is to remove "." only from a given string then Simple Way is better.But If you want special characters to be removed from string then you either need REGEX or Through Loop and replace characters. For REGEX you have to find the REGEX to remove special characters. Thanks, Nilesh Upadhyay
-
HI , Thank you for your comment, but I have just seen this question. I am not posting answer for any points in fact I don't even know that How the point system is calculated because I am not an active member to give answer frequently. Sorry if my answer gives wrong information to anyone . My intention was to provide an answer with multiple ways to achieve the stated thing. Thanks, Nilesh
-
Hi Riaz, you can remove "." from a given string from the following ways: 1) Simple way :
string strValue = "This. is .test .string. that. removes the (DOT) from the. string";
strValue = strValue.Replace(".",string.Empty);- REGEX WAY :
string strValue = "This. is .test .string. that. removes the (DOT) from the. string";
strValue = System.Text.RegularExpressions.Regex.Replace(strValue, @"\.+", "");please check the value of strValue ( you find that "." is removed from the given string ) 3) Through Loop and replace characters: Here for simplicity I have made a static function that will take input as a string and returns a string by replacing "." NOTE :- To Remove all special characters including white space from the given string just uncomment the first line in below function.
public static string RemoveSpecialChars(string str)
{
//string[] chars = new string[] { ",", ".", "/", "!", "@", "#", "$", "%", "^", "&", "*", "'", "\"", ";", "-", "_", "(", ")", ":", "|", "[", "]", " " };
string[] chars = new string[] { "." };
for (int i = 0; i < chars.Length; i++)
{
if (str.Contains(chars[i]))
{
str = str.Replace(chars[i], "");
}
}
return str;
}Now use this function anywhere to remove "." from input string . Please check below example for how to use :
string strValue = "This. is .test .string. that. removes the (DOT) from the. string";
strValue = RemoveSpecialChars(strValue );please check the value of strValue ( you find that "." is removed from the given string ) Note :- If your purpose is to remove "." only from a given string then Simple Way is better.But If you want special characters to be removed from string then you either need REGEX or Through Loop and replace characters. For REGEX you have to find the REGEX to remove special characters. Thanks, Nilesh Upadhyay
For completeness you could also include the Split/Join technique. :-D
-
If someone has already answered why post exactly the same answer??? :mad:
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
I often take a long time writing a response, doing research to ensure my answer is correct, many people can post while I'm still writing.