Click here to Skip to main content
13,598,616 members
Click here to Skip to main content
Add your own
alternative version


10 bookmarked
Posted 4 Aug 2002
Licenced CPOL

Float and datetime to Vietnamese textual

, 4 Aug 2002
Rate this:
Please Sign up or sign in to vote.
A DLL to convert Float and datetime to Vietnamese textual string
<!-- Add the rest of your HTML here -->


There is a high demand for converting float data and datetime to textual presentation. You can find its application in many different actual situations such as declaring bank amount, tax amount, money invoice amount etc, especially in IVR (Interactive Voice Response)applications.

I was involved in a IVR application, specifically a Telephone Banking center in which we produced voice stream to state customers' balance. If you have a TTS (Text to speech) engine, everything would be simple: you select balance amount from the database as a float number and the engine will speak it out. The fact is not so wonderful, when we developed this program, there was no such Vietnamese TTS engine. Hence we have to do everything by hand, i.e. convert customer's balance to a texttual representation, then produce voice stream from a series of pre-recorded voice files.

From that time, my application runs fine. If you want, you can dial 84-4-8313895 and ask for Telephone Banking ext. The pseudo TTS engine I created is wrapped in a DLL because the script we used in our IVR system can only call a DLL with a predetermine function type, i.e. :

char* extern C yourfunction(char* inputstring)


Hence my DLL has the following functions:

extern "C" NUMANALYSE_API char *VS_MainNum(char *numstr)
//Example VS_MainNum("-12345.89")

extern "C" NUMANALYSE_API char *VS_NonCount(char *numstr)
//Example VS_NonCount("12A76B009CD87")

extern "C" NUMANALYSE_API char *VS_DateTimeV(
  char *numstr="0000 00 00 00:00:00")
//Example VS_DateTimeV("2002 12 20 16:30:20")

extern "C" NUMANALYSE_API char *VS_DateTimeE(
  char *numstr="0000 00 00 00:00:00")
//Example VS_DateTimeE("2002 12 20 16:30:20")

extern "C" NUMANALYSE_API char *VS_CardinalE(char *numstr)
//Example VS_CardinalE("-12345.67")

extern "C" NUMANALYSE_API char *VS_OrdinalE(char *numstr)
//Example VS_OrdinalE("12345")

And in the core are the classes:

class CSonNumV 
    static char * NoncountV(char * numstr, char * g_num); 
    static char * CardinalV(char *numstr, char *g_num); 
    virtual ~CSonNumV(); 
    static CString FirstTwo(int tw); 
    static CString FirstThree(int th); 
    static CString Fractal(CString cstw); 
    static CString NumComb(double x, char *s); 

class CSonTime : public CTime 
    CString FormatE(LPCTSTR fmtString); 
    CSonTime(LPCTSTR mstr); 
    typedef char * (*funcptr)(char *); 
    void put_pfnV(funcptr x); 
    CString FormatV(LPCTSTR fmtString); 
    CSonTime(int nYear, int nMonth, int nDay, int nHour, int nMin, 
        int nSec, int nDST = -1 ); 
    CSonTime(const CSonTime& timeSrc); 
    CSonTime& CSonTime::operator =(const CSonTime &timeSrc); 
    CSonTime& CSonTime::operator =(LPCTSTR mstr); 
    virtual ~CSonTime(); 
    CString get_partE(char b); 
    CString get_partV(char a); 
    funcptr m_pfnV; 

class CSonJFancolNumE 
    static char * OrdinalE(char * numstr, char * g_num); 
    static char * CardinalE(char *numstr, char *g_num); 
    CSonJFancolNumE(); virtual ~CSonJFancolNumE(); 


I also want to give credit to Eduardo Velasquez for his Tokenizer class and Jeremy Lee Falcon for his NumWord English textual representation as I use his work to produce English representation in my DLL. Thank you and have fun


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


About the Author

You may also be interested in...

Comments and Discussions

Questionivr help Pin
samifiaz2k17-Jul-07 1:44
membersamifiaz2k17-Jul-07 1:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.180621.3 | Last Updated 5 Aug 2002
Article Copyright 2002 by Nguyen Luong Son
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid