Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to convert number to string....

for eg.

JavaScript
var str='95 HP to 60 HP';

var a= numToStr(str);


now numToStr() should return Ninety five HP to Sixty HP.
where numToStr() is the function that does this conversion.

You can code in any language either javascript or vb or c#.
thanx in advance.
Posted
Updated 30-Dec-14 22:44pm
v2
Comments
Neetin_1809 31-Dec-14 4:54am    
Hello Jagdish, DO a Little Bit Googling.i Will Suggest you to split a string on the basis of space.Then Check for each string is a number or not.
Refer the Following Links:
http://www.codeproject.com/Articles/15934/How-to-Convert-a-Numeric-Value-or-Currency-to-Engl
Hope It Helps You.
jagdish123061 31-Dec-14 5:36am    
thanx for the idea....
[no name] 31-Dec-14 5:22am    
Hey Stop ordering us to do for you. Rather you try first and do some primary googling and then you ask for help. We are not your slaves to do your job.

Split out the numeric parts, and then see here: Converting numbers to the word equivalent. [^]

If that doesn't help, sit down and do your own homework!
 
Share this answer
 
Hi,

Have a look at the humanizer library.

It contains a .net implementation of the number to words functionality.

Hope it helps,
 
Share this answer
 
Comments
jagdish123061 31-Dec-14 5:44am    
thanx for this library but how to install it on asp.net.
hypermellow 31-Dec-14 6:00am    
Hi, to add to your project, install via nuget:
https://www.nuget.org/packages/Humanizer
 
Share this answer
 
I had splited a string on the basis of space.Then converted each number to words.
Thanx @Neetin_1809
 
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