Created
August 7, 2019 08:28
-
-
Save yurist38/f01143ca792ede295bfdb8f957e3bb28 to your computer and use it in GitHub Desktop.
WeIrDcAsE
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
void main() { | |
print(toWeirdCase('Wazzap')); | |
} | |
toWeirdCase(String str) { | |
var result = new List(); | |
for (int i = 0; i < str.length; i++) { | |
result.add(i%2 == 0 ? str[i].toUpperCase() : str[i].toLowerCase()); | |
} | |
return result.join(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment