Click here to Skip to main content
15,916,379 members
Home / Discussions / C#
   

C#

 
AnswerRe: SAPI 5.1 displaying training UI from C# [modified] Pin
GuyThiebaut7-Jan-08 10:16
professionalGuyThiebaut7-Jan-08 10:16 
GeneralRe:Configuring PPPOE settings usign C# in windows Vista Pin
RameshwerE7-Jan-08 4:34
RameshwerE7-Jan-08 4:34 
GeneralAny idea on progresspar Pin
Strategic_Thinker7-Jan-08 4:34
Strategic_Thinker7-Jan-08 4:34 
GeneralRe: Any idea on progresspar Pin
Judah Gabriel Himango7-Jan-08 4:42
sponsorJudah Gabriel Himango7-Jan-08 4:42 
GeneralRe: Any idea on progresspar Pin
mark_w_7-Jan-08 4:45
mark_w_7-Jan-08 4:45 
QuestionString equivalent of a double Pin
edel_ong7-Jan-08 3:29
edel_ong7-Jan-08 3:29 
GeneralRe: String equivalent of a double Pin
originSH7-Jan-08 3:39
originSH7-Jan-08 3:39 
GeneralRe: String equivalent of a double Pin
Skippums7-Jan-08 4:02
Skippums7-Jan-08 4:02 
digitNames = new string[] { "", "one", "two" ... };
tensDigitNames = new string[] { "", "ten-", "twenty-", "thirty-" ... };
magnitudeNames = new string[] { "", " thousand", " million" ... };

1. Initialize a string called "result" to the fractional part preceded with an "&"
2. Initialize an integer array called "number" of the digits of the number, from LSD to MSD
   (in your example, {9, 8, 7, ... 3})
3. Iterate through the digits in "number" to get the variables "curDigit" and "curDigitIdx"
4. Perform the following logic using curDigitIdx (the index in your array) and curDigit
switch (curDigitIdx % 3) {
    case 0:
        result = string.Format("{0}{1} {2}", digitNames[curDigit],
                 magnitudeNames[curDigitIdx / 3], result);
        break;
    case 1:
        result = string.Format("{0}{1}", tensDigitNames[curDigit], result);
        break;
    case 2:
        result = string.Format("{0} hundred {1}", digitNames[curDigit], result);
        break;
}
Note that the preceding code is simply a starting point, and that the formatting will require a number of special cases (such as getting 11 to be printed as "eleven" as opposed to "ten-one" and 50 being printed as "fifty" instead of "fifty-". Hope this helps,

Sounds like somebody's got a case of the Mondays

-Jeff

GeneralRe: String equivalent of a double Pin
Luc Pattyn7-Jan-08 5:04
sitebuilderLuc Pattyn7-Jan-08 5:04 
GeneralRe: String equivalent of a double Pin
edel_ong7-Jan-08 6:07
edel_ong7-Jan-08 6:07 
GeneralMoving messages Pin
simworld7-Jan-08 3:26
simworld7-Jan-08 3:26 
GeneralRe: Moving messages Pin
Pete O'Hanlon7-Jan-08 3:50
mvePete O'Hanlon7-Jan-08 3:50 
GeneralRe: Moving messages Pin
simworld7-Jan-08 8:07
simworld7-Jan-08 8:07 
GeneralRe: Moving messages Pin
Luc Pattyn7-Jan-08 9:07
sitebuilderLuc Pattyn7-Jan-08 9:07 
GeneralRe: Moving messages Pin
simworld8-Jan-08 7:37
simworld8-Jan-08 7:37 
GeneralRegex.Matches() problem Pin
Seishin#7-Jan-08 2:42
Seishin#7-Jan-08 2:42 
GeneralRe: Regex.Matches() problem Pin
LuCasn7-Jan-08 2:45
LuCasn7-Jan-08 2:45 
GeneralRe: Regex.Matches() problem Pin
Seishin#7-Jan-08 2:57
Seishin#7-Jan-08 2:57 
GeneralRe: Regex.Matches() problem Pin
Skippums7-Jan-08 2:56
Skippums7-Jan-08 2:56 
GeneralRe: Regex.Matches() problem Pin
Seishin#7-Jan-08 3:09
Seishin#7-Jan-08 3:09 
QuestionWho tells an object the application wants to exit and where? Pin
LuCasn7-Jan-08 2:40
LuCasn7-Jan-08 2:40 
GeneralRe: Who tells an object the application wants to exit and where? Pin
Skippums7-Jan-08 3:09
Skippums7-Jan-08 3:09 
GeneralRe: Who tells an object the application wants to exit and where? Pin
LuCasn7-Jan-08 3:15
LuCasn7-Jan-08 3:15 
GeneralRe: Who tells an object the application wants to exit and where? Pin
Skippums7-Jan-08 3:24
Skippums7-Jan-08 3:24 
GeneralRe: Who tells an object the application wants to exit and where? Pin
LuCasn7-Jan-08 3:36
LuCasn7-Jan-08 3:36 

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.