35 lines
		
	
	
		
			983 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			983 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Text;
 | |
| 
 | |
| namespace Volian.Controls.Library
 | |
| {
 | |
| 	class AlphabeticalNumbering
 | |
| 	{
 | |
| 		//private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
 | |
| 		private static string Letter(int number)
 | |
| 		{
 | |
| 			char c = (char)(number + 64);
 | |
| 			return c.ToString();
 | |
| 		}
 | |
| 		public static string Convert(int number)
 | |
| 		{
 | |
| 			string retval=string.Empty;
 | |
| 			if (number > 26) retval += Letter((number-1) / 26);
 | |
| 			retval += Letter(1 + ((number-1) % 26));
 | |
| 			return retval;
 | |
| 		}
 | |
| 		//private static int[] _TestLetters = new int[] {
 | |
| 		//    1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,
 | |
| 		//    52,53,78,79,104,105
 | |
| 		//  };
 | |
| 		//public static void ShowLetters()
 | |
| 		//{
 | |
| 		//  for (int i = 0; i < _TestLetters.Length; i++)
 | |
| 		//  {
 | |
| 		//    if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0},{1}", _TestLetters[i], Convert(_TestLetters[i]));
 | |
| 		//  }
 | |
| 		//}
 | |
| 	}
 | |
| }
 | 
