How to reverse a string

前端 未结 6 1253
北荒
北荒 2021-01-15 19:53

I need to reverse the string of a user\'s input.

I need it done in the simplest of ways. I was trying to do reverseOrder(UserInput) but it wasn\'t working.

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-15 20:31

    new StringBuilder(str).reverse().toString()
    

    java.util.Collections.reverseOrder is for sorting in reverse of normal order.

提交回复
热议问题