Click here to Skip to main content
15,890,973 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to split the string $950 . And want 950 only .
Posted

Why do you want to split. Use SubString or Replace.
Like price.SubString(1) or price.Replace("$","")
 
Share this answer
 
v2
Comments
Vimalrashamra 3-Nov-11 2:49am    
double suma = double.Parse(labl.Text);

labl.text contains $120 now how i remove $ .
Prerak Patel 3-Nov-11 2:52am    
Use like this, double suma = double.Parse(labl.Text.Replace("$",""));
Mehdi Gholam 3-Nov-11 2:50am    
So simple! 5!
check this code

C#
string str1 = "$250";
 str1 = str1.Replace('$', ' ').Trim();
 
Share this answer
 
v2
Comments
Mehdi Gholam 3-Nov-11 2:51am    
Replace("$","") is better and no Trim required.
string str = "$120";
if(str.contains("$"))
{
   str.replace("$",string.Empty);
}

O/p: 120
 
Share this answer
 
string[] var = str.Split('$');
string value=var[1].ToString();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900