Thanks Chris - perfect for what I needed to do - works great!!
Doug Wilson | Applications Developer | iX Webhouse iX Headoffice | Umhlanga, South Africa | Mobile: +2783 6412944 Tel: +2731 5669250 | Fax: +2731 5669260 | Email: mailto:[EMAIL PROTECTED] _____ From: Chris Hynes [mailto:[EMAIL PROTECTED] Sent: 08 July 2004 12:05 AM To: [EMAIL PROTECTED] Subject: RE: [AspNetAnyQuestionIsOk] Get Next Character The simple way to do this is to cast to byte, increment, then cast back to char. Like so: -- char ch = 'a'; byte bt = (char)ch; bt++; ch = (char)bt; -- Problem is, char's can be unicode as well... it would probably be better to use System.Encoding.ASCII. Like so: -- char ch = 'a'; byte[] bytes = System.Text.Encoding.ASCII.GetBytes(new char[] {ch}); bytes[0]++; ch = System.Text.Encoding.ASCII.GetChars(bytes)[0]; -- I don't particularly like either of these methods, as they rely on the ASCII codes being sequential. Personally, I would rather generate a lookup table array and index into that instead... Chris -----Original Message----- From: Doug Wilson [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 07, 2004 5:40 PM To: [EMAIL PROTECTED] Subject: [AspNetAnyQuestionIsOk] Get Next Character Hi All I need to increment a character counter. For example, if I was passed the character 'a' as a parameter I would need to return 'b'. If passed 'c', then return 'd'. So, the way I assume to do it would be to convert to ASCII code, add 1 to the ASCII code, and then convert back to it's character mapping, but have no idea how to do this in C#. If anyone has done this or knows how, please let me know urgently. Thanks and regards ------------------------ Yahoo! Groups Sponsor --------------------~--> Yahoo! Domains - Claim yours for only $14.70 http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/saFolB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links Yahoo! Groups Sponsor ADVERTISEMENT <http://us.ard.yahoo.com/SIG=129cs5gj9/M=295196.4901138.6071305.3001176/D=gr oups/S=1705006764:HM/EXP=1089324348/A=2128215/R=0/SIG=10se96mf6/*http:/compa nion.yahoo.com> click here <http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S= :HM/A=2128215/rand=461907317> _____ Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED] e> * Your use of Yahoo! Groups is subject to the Yahoo! <http://docs.yahoo.com/info/terms/> Terms of Service. [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> Yahoo! Domains - Claim yours for only $14.70 http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/saFolB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
