Skip to content

Instantly share code, notes, and snippets.

@digitalconceptvisuals
Created July 30, 2020 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digitalconceptvisuals/d52e74dc3e265fbcdfd29899c3e25f80 to your computer and use it in GitHub Desktop.
Save digitalconceptvisuals/d52e74dc3e265fbcdfd29899c3e25f80 to your computer and use it in GitHub Desktop.
/**
* 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