Expressions Vs Statements
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
public static string ToUppercaseExpression(this string currentString) => | |
new string(currentString.Select(c => (char)(c < 97 || c > 122 ? c : c - 32)).ToArray()); | |
public static string ToUppercaseStatements(this string currentString) | |
{ | |
var returnValue = new StringBuilder(); | |
foreach(var c in currentString) | |
{ | |
if(c < 97 || c > 122) | |
{ | |
returnValue.Append(c); | |
} | |
else | |
{ | |
returnValue.Append((char)(c - 32)); | |
} | |
} | |
return returnValue.ToString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment