Skip to content

Instantly share code, notes, and snippets.

@yurist38
Created August 7, 2019 08:28
Show Gist options
  • Save yurist38/f01143ca792ede295bfdb8f957e3bb28 to your computer and use it in GitHub Desktop.
Save yurist38/f01143ca792ede295bfdb8f957e3bb28 to your computer and use it in GitHub Desktop.
WeIrDcAsE
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