Answers for "dart reverse a string"

1

reverse srring in dart

import 'dart:io';

void main() {
  
  stdout.write("Please give a word: ");
  String input = stdin.readLineSync().toLowerCase();
  String revInput = input.split('').reversed.join('');
  }
Posted by: Guest on July-05-2021
1

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;
}
Posted by: Guest on March-02-2021
0

srring reverse dart

string.split('').reversed.join('');
Posted by: Guest on September-14-2020

Code answers related to "Dart"

Browse Popular Code Answers by Language