N
N
Nikita Zavialov2016-10-13 11:24:57
Java
Nikita Zavialov, 2016-10-13 11:24:57

How to mirror a string?

It is necessary that when you enter (for example - an apple, it is displayed okolbya), the program changes the line in a mirror way. I sit, I'm dumb, I can't remember. Help me please.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexey Ukolov, 2016-10-13
@alexey-m-ukolov

https://www.google.ru/search?q=java%20reverse%20string

A
Alexander, 2016-10-13
@NeiroNx

"яблоко".split('').reverse().join('')

I
iSergios, 2016-10-13
@iSergios

True, I am a pythonist, I don’t know about the reverse method in Java, but I know that String can split, and arrays can be cycled in reverse order :)
In general, yes, there is a more elegant way, and it is the first line in Google.

R
Ruslan Melnik, 2016-11-13
@relavus1981

In python, you can do this:
name = 'apple'
print(name[::-1]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question