-
-
Save digitalconceptvisuals/d52e74dc3e265fbcdfd29899c3e25f80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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