Как изменить строку в Python
# in order to make a string reversed in python
# you have to use the slicing as following
string = "racecar"
print(string[::-1])
Tejas Naik
# in order to make a string reversed in python
# you have to use the slicing as following
string = "racecar"
print(string[::-1])
'hello world'[::-1]
'dlrow olleh'
public class ReverseString {
public static void main(String[] args) {
String s1 = "neelendra";
for(int i=s1.length()-1;i>=0;i--)
{
System.out.print(s1.charAt(i));
}
}
}
// string::rbegin/rend
#include <iostream>
#include <string>
int main ()
{
std::string str ("now step live...");
for (std::string::reverse_iterator rit=str.rbegin(); rit!=str.rend(); ++rit)
std::cout << *rit;
return 0;
}
const stringReverse = str => str.split("").reverse().join("");
stringReverse("Welcome to Javascript")
//tpircsavaJ ot emocleW
String name = "gaurav";
String reversedString = new StringBuilder(name).reverse().toString();
System.out.println(reversedString);