Click here to Skip to main content
16,015,679 members
Home / Discussions / C#
   

C#

 
GeneralRe: class Pin
BoneSoft25-Jan-08 18:55
BoneSoft25-Jan-08 18:55 
GeneralRe: class Pin
DaveyM6925-Jan-08 21:29
professionalDaveyM6925-Jan-08 21:29 
GeneralRe: class Pin
Spacix One26-Jan-08 5:57
Spacix One26-Jan-08 5:57 
AnswerRe: class Pin
Guffa26-Jan-08 8:16
Guffa26-Jan-08 8:16 
GeneralGeneric List Remove method delay Pin
DaveyM6925-Jan-08 12:35
professionalDaveyM6925-Jan-08 12:35 
GeneralRe: Generic List Remove method delay Pin
Abhijit Jana25-Jan-08 23:27
professionalAbhijit Jana25-Jan-08 23:27 
GeneralRe: Generic List Remove method delay Pin
DaveyM6925-Jan-08 23:31
professionalDaveyM6925-Jan-08 23:31 
GeneralString Reversal plus character replacement Pin
BREdwards25-Jan-08 11:25
BREdwards25-Jan-08 11:25 
Hello, I'm currently in the midst of taking an assessment test, and I need some help with something. essentially, what I need to do, is dynamically reverse a string as it is entered into a text box, and while it is being reversed, replace every number entered (1,2,3) with it's word equivalent (one,two,three). Now I have the string reversal part nailed with the following function:
<br />
public string Reverse(string x)<br />
		{<br />
			char[] charArray = new char[x.Length];<br />
			int len = x.Length - 1;<br />
			for (int i = 0; i <= len; i++)<br />
				charArray[i] = x[len-i];<br />
			return new string(charArray);<br />
		}<br />


My main problem is I am not very sure how to dynamically change the numbers to words as the entered string is being reversed. I am considering using some code along the lines of this:
<br />
public string numCheck(string x)<br />
        {   <br />
          string[] numbers = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };<br />
          string[] words = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };<br />
           string strReplaced = "";   <br />
            int i;<br />
           for(i=0; i9)           <br />
	 {<br />
strReplaced = x.Replace(numbers[i], words[i]);<br />
              x = x.Replace(ch);<br />
          }<br />
             return x;           <br />
         }<br />


However, I do not know how to properly insert this into the rest of my program to get the desired result, or even if this is the best way to do it. Thank you in advance.
GeneralRe: String Reversal plus character replacement Pin
pmarfleet25-Jan-08 11:54
pmarfleet25-Jan-08 11:54 
GeneralRe: String Reversal plus character replacement Pin
BREdwards25-Jan-08 12:16
BREdwards25-Jan-08 12:16 
GeneralRe: String Reversal plus character replacement Pin
pmarfleet25-Jan-08 12:25
pmarfleet25-Jan-08 12:25 
GeneralRe: String Reversal plus character replacement Pin
PIEBALDconsult25-Jan-08 13:21
mvePIEBALDconsult25-Jan-08 13:21 
GeneralRe: String Reversal plus character replacement Pin
BREdwards25-Jan-08 17:31
BREdwards25-Jan-08 17:31 
GeneralRe: String Reversal plus character replacement Pin
DaveyM6925-Jan-08 22:00
professionalDaveyM6925-Jan-08 22:00 
GeneralRe: String Reversal plus character replacement Pin
DaveyM6925-Jan-08 22:40
professionalDaveyM6925-Jan-08 22:40 
GeneralRe: String Reversal plus character replacement Pin
BREdwards26-Jan-08 17:42
BREdwards26-Jan-08 17:42 
QuestionOval buttons and using transparency Pin
MikeWeber25-Jan-08 10:55
MikeWeber25-Jan-08 10:55 
GeneralRe: Oval buttons and using transparency Pin
DaveyM6925-Jan-08 12:52
professionalDaveyM6925-Jan-08 12:52 
GeneralRe: Oval buttons and using transparency Pin
mav.northwind25-Jan-08 21:55
mav.northwind25-Jan-08 21:55 
QuestionCan I raise an event for a class rather than an object? Pin
Clive D. Pottinger25-Jan-08 7:42
Clive D. Pottinger25-Jan-08 7:42 
GeneralRe: Can I raise an event for a class rather than an object? Pin
Ed.Poore25-Jan-08 7:45
Ed.Poore25-Jan-08 7:45 
GeneralRe: Can I raise an event for a class rather than an object? Pin
Clive D. Pottinger25-Jan-08 10:19
Clive D. Pottinger25-Jan-08 10:19 
GeneralRe: Can I raise an event for a class rather than an object? Pin
Ed.Poore25-Jan-08 12:18
Ed.Poore25-Jan-08 12:18 
AnswerRe: Can I raise an event for a class rather than an object? Pin
BoneSoft25-Jan-08 8:16
BoneSoft25-Jan-08 8:16 
GeneralRe: Can I raise an event for a class rather than an object? Pin
Clive D. Pottinger25-Jan-08 10:50
Clive D. Pottinger25-Jan-08 10:50 

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.