convert anynumber to text [modified]
-
Hi, I need to do something similiar to: I need to convert any random number, to text. How would I do this?
private function getDateFormat() as string Dim theDate as string = "01-06-2005 13:45:30" Dim theDateFormat as string = "dd-mm-yyyy hh:mm:ss" 'need function here to convert to text, or something else? return "1st June 2005, Quarter-To-Two" End sub
-
Hi, I need to do something similiar to: I need to convert any random number, to text. How would I do this?
private function getDateFormat() as string Dim theDate as string = "01-06-2005 13:45:30" Dim theDateFormat as string = "dd-mm-yyyy hh:mm:ss" 'need function here to convert to text, or something else? return "1st June 2005, Quarter-To-Two" End sub
what do you mean any number?!! if you mean double single integer ,... you can use ToString method for making your method work for all types simply use Object like
Private Function ConvertToString(byval obj as Object)as string return obj.ToString() End Function
and there is another way too use Convert.ToString method but I have some doubt you wanted that when I look at your code! -
Hi, I need to do something similiar to: I need to convert any random number, to text. How would I do this?
private function getDateFormat() as string Dim theDate as string = "01-06-2005 13:45:30" Dim theDateFormat as string = "dd-mm-yyyy hh:mm:ss" 'need function here to convert to text, or something else? return "1st June 2005, Quarter-To-Two" End sub
A date is not a number. You can use the DateTime.ParseExact method to parse your string into a DateTime value. When you have the DateTime value, you can format it any way you like. There is no built-in format like "Quarter-To-Two", so you have to implement that yourself.
--- single minded; short sighted; long gone;
-
Hi, I need to do something similiar to: I need to convert any random number, to text. How would I do this?
private function getDateFormat() as string Dim theDate as string = "01-06-2005 13:45:30" Dim theDateFormat as string = "dd-mm-yyyy hh:mm:ss" 'need function here to convert to text, or something else? return "1st June 2005, Quarter-To-Two" End sub
What you are askng is complex. There is no in built function in .net to return a given number as words. You would have to build a module and pass values to it, but this module would be very big and you would have to enter each word corresponding to a number manuelly.
Please check out my articles: The ANZAC's articles