c# - How to convert a string to a char (to a string) -


i hope title didn't confuse much. i'm trying :

static dictionary<string, char> charmap = new dictionary<string, char>()        {            {"alpha ", 'a'},{"beta ",'y'},{"gamma ", 'g'},{"delta", '='}        };         static string charmap(string value)        {            var strings = value                .select(c =>                {                    string letter;                    if (!charmap.trygetvalue(the, out letter))                        letter = c.tostring();                    return letter;                });            return string.join("", strings);        } 

i want to :

input - alpha beta gamma delta

output - ayg=

how can code work?

try this

 var stringtosearch =  value.split(new[] { ' ' }, stringsplitoptions.removeemptyentries).tolist();  var result = string.concat( charmap.where(o => stringtosearch.contains(o.key)).tolist().select(a => a.value)); 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -