-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Richard-Hsu
Message 3 in Discussion

 Hi,   Well, I said that it should be simple to implement a working version. I was 
wrong, it wasn't simple, at least not like a 5 mins job that I meant. But here is a 
working version of rot13 :-   To see the full code (with comments) online go to :-
http://richard_hsu.europe.webmatrixhosting.net/community/showcode.aspx?file=rot13.cs   
Here is the bare minimum code fragment for those of us who are impatient types :-     
static string Rot13It(string text)
    {
        string result = "";
        
        char alpha;
        
        foreach(Char eachAlpha in text) {
        
            alpha = eachAlpha; 
            
            char firstAlpha, lastAlpha;
                
            if (Char.IsLetter(alpha)) {
                
                if (Char.IsLower(alpha)) {
                    firstAlpha = 'a';
                    lastAlpha = 'z';
                } else {                    
                    firstAlpha = 'A';
                    lastAlpha = 'Z';
                }                 alpha = (char)(alpha + 13);                 if 
(alpha > lastAlpha) {
                    alpha = (char) (alpha - lastAlpha + firstAlpha - 1) ;
                }
            }
            
            result += alpha;
        }
        
        return result;
    }   Awaiting feedback and possibly some code.   Regards,
Richard.

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to