How do I reverse a String in Dart?

前端 未结 7 993
面向向阳花
面向向阳花 2021-02-03 20:13

I have a String, and I would like to reverse it. For example, I am writing an AngularDart filter that reverses a string. It\'s just for demonstration purposes, but it made me wo

7条回答
  •  忘掉有多难
    2021-02-03 20:51

    The library More Dart contains a light-weight wrapper around strings that makes them behave like an immutable list of characters:

    import 'package:more/iterable.dart';
    
    void main() {
      print(string('Hello World').reversed.join());
    }
    

提交回复
热议问题