Created
October 17, 2020 04:29
-
-
Save MelbourneDeveloper/f5ea258897648e9796eb6e36f6beb193 to your computer and use it in GitHub Desktop.
Expressions Vs Statements
This file contains hidden or 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