Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PHP:
- echo strrev("Hello world!"); //outputs "!dlrow olleH"
- Java:
- String string="Hello World";
- String reverse = new StringBuffer(string).reverse().toString();
- System.out.println(reverse); //outputs "dlroW olleH"
- C++:
- string text = "Hello world";
- reverse = string ( text.rbegin(), text.rend() );
- cout << reverse; //outputs "dlrow olleH"
- C: (must include <string.h>)
- char arr[100];
- arr = "Example text";
- strrev(arr);
- printf(arr); //outputs "txet elpmaxE"
Advertisement
Add Comment
Please, Sign In to add comment