Remove comma from a string with contains price [Resolved]

Posted by Gemamgall under ASP.NET on 6/27/2012 | Points: 10 | Views : 2008 | Status : [Member] | Replies : 4
How can i remove comma from multiple positions in a string
example 1,12,10,400 is to be converted to 11210400

Thanks and Regards,

Vinay Gandhi
www.quadtechindia.com



Responses

Posted by: Ajay.Kalol on: 6/27/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
in C# :
string str = "1,12,10,400,11,345,66";

str.Replace(",", "");


in SQL server

declare @s VARCHAR(10)

SET @s = '1,2,3'

SELECT REPLACE(@s,',','')


Ajay
ajaypatelfromsanthal.blogspot.in

Gemamgall, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bhupentiwari on: 6/27/2012 [Member] Starter | Points: 25

Up
0
Down
You can create function and pass string to that use the following function

public string RemoveComma(string t)

{
string newt = string.Empty;
for (int i = 0; i < t.Length; i++)
{
if (t[i] != ',')
{
newt = newt + t[i];
}

}
return newt;
}




Thanks n Regards
Bhupendra Tiwari

Gemamgall, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagar28 on: 6/27/2012 [Member] Starter | Points: 25

Up
0
Down
string amount=" 1,12,10,400";
amount=amount.Replace(",", "");


Gemamgall, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gemamgall on: 6/27/2012 [Member] Starter | Points: 25

Up
0
Down
Thanks a lot!!!

Thanks and Regards,

Vinay Gandhi
www.quadtechindia.com

Gemamgall, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response