How to convert a number to alpha character C# -


i new c# , need know how convert number alpha character. example if variable 10 passed need convert 10 nd , on.

if  0 convert uh if 02 convert ij if 10 convert nd if 45 convert yh if 48 convert ol 

i searched , not find looking for.

for further clarification (sorry not explaining fully)

i have system passing numerical value equivalent alpha value in system. working on app allows these 2 systems communicate. needing translation table of sorts allows me change numerical value equivalent alpha value. doing allow me make soap call correct parameters.

i can't see logic those, i'll assume mapping external somewhere. 2 options - switch, or dictionary.

string result; switch(num) {     case 0: result = "uh"; break;     //...     case 48: result = "ol"; break;     default: throw new argumentoutofrangeexception(); } console.writeline(result); 

or alternatively, dictionary:

static readonly dictionary<int,string> map = new dictionary<int,string> {     {0, "uh"},     //...     {48, "ol"} }; ... string result; if(!map.trygetvalue(num, out result))     throw new argumentoutofrangeexception(); console.writeline(result); 

edit: 3rd option - enum:

enum map {   uh = 0,   //...   ol = 48 } ... map mapped = (map)num; console.writeline(mapped); // also, string result = mapped.tostring(); if need 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -