reverse the order of characters in a string

后端 未结 13 1041
逝去的感伤
逝去的感伤 2020-12-04 15:03

In string \"12345\", out string \"54321\". Preferably without third party tools and regex.

13条回答
  •  隐瞒了意图╮
    2020-12-04 15:37

    This reverses the string "in place":

    a=12345
    len=${#a}
    for ((i=1;i

    or the third line could be:

    for ((i=0;i

    or

    for ((i=1;i

提交回复
热议问题