We're a place where coders share, stay up-to-date and grow their careers.
Solution in Dart. Simple and not the shortest one, I guess. But it works =)
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(); }
Link to the playground: dartpad.dartlang.org/f01143ca792ed...
Solution in Dart. Simple and not the shortest one, I guess. But it works =)
Link to the playground: dartpad.dartlang.org/f01143ca792ed...