Click here to Skip to main content
15,893,622 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi guys.. im having problem on how to remove format on a number input..
my problem is how to remove the currency format like for example "1,000.00" i just want to remove the commas and period on it so that it will something like this "1000" or i guess i just need to change the format of it.. sorry for my bad english guys..
Posted
Comments
Sergey Alexandrovich Kryukov 17-Aug-13 1:55am    
By default, there are no commas. How did you get such output, exactly?
—SA
lalar18 28-Aug-13 7:10am    
i have changed the format of the number... by format(x,"#0,000.00"), this is a sample.. and i want for example to return the old format of the number i have inputed. sorry for my bad english..

Please see my comment to the question. You need to pay some effort to specify the format with separators, but by default you already got what you needed. Simple int.ToString() will return what you want or string.Format("{0} ...", myNumericValue)...

For more advanced formatting, see also:
http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx[^],
http://msdn.microsoft.com/en-us/library/0c899ak8.aspx[^].

—SA
 
Share this answer
 
Comments
ridoy 17-Aug-13 2:17am    
my 5,already a good answer from you but i try a slight different approach,:)
Sergey Alexandrovich Kryukov 17-Aug-13 2:47am    
Thank you.
I commented on your answer, not quite sure. Even it OP wanted to "convert" string from string, the concern should be expressed, how the format with separators appeared in first place; that could be a root of the problem.
—SA
ridoy 17-Aug-13 3:08am    
Agree.
You could try using the parse method of the "single" or "double" type..
If your number is .....00.00 format then simply this
VB
double.Parse("1,000,000.00")

would give you 1000000
 
Share this answer
 
v3
Comments
Sergey Alexandrovich Kryukov 17-Aug-13 2:45am    
Why? I'm not sure input is string, why would it be? There is some change that OP tends to work with strings representing data instead of data itself, like many beginner these days, but we cannot be sure.
—SA
ridoy 17-Aug-13 2:57am    
yes you're right.in that case int.toString() will do the trick that you already mentioned.:)
Sergey Alexandrovich Kryukov 17-Aug-13 2:58am    
Actually, some feedback from OP could help...
—SA
ridoy 17-Aug-13 3:07am    
Yes,i also think so.It completely depends on him whether he uses number or string.

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