How do I reverse a String in Dart?

前端 未结 7 768
面向向阳花
面向向阳花 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:48

    There is a utils package that covers this function. It has some more nice methods for operation on strings.

    Install it with :

    dependencies:
      basic_utils: ^1.2.0
    

    Usage :

    String reversed = StringUtils.reverse("helloworld");
    

    Github:

    https://github.com/Ephenodrom/Dart-Basic-Utils

提交回复
热议问题