Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
* changeCase now uses converter Dictionary
* If a converter is found, it invokes it
* or else returns null
*/
public string changeCase(string caseType, params string[] words)
{
// Sanitize the input
caseType = caseType.Trim().ToLower();
// Lookup the converter function in dictonary
ConverterFunction converter;
converters.TryGetValue(caseType, out converter);
if (converter !=null)
return converter(words);
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment