reverse string dart code example
Example 1: srring reverse dart
string.split('').reversed.join('');
Example 2: dart reverse a string
// Library approach
String solution1(str) {
return str.split('').reversed.join('');
}
// With runes
String solution(String str) => str.runes.toList().reversed.map((e) => String.fromCharCode(e)).join('');
// DIY approach
String solution(str) {
String reversed = "";
for(var i =str.length-1; i>=0; i--)
reversed+=str[i];
return reversed;
}