Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Reverse a String

class Reverse
{
    // Complete the function
    // str: input string
    public static String reverseWord(String str)
    {
        String rev = new String();
        for(int i = str.length()-1; i>=0; i--){
            rev += str.charAt(i);
        }
        return rev;
        // Reverse the string str
    }
}
Source by practice.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #Reverse #String
ADD COMMENT
Topic
Name
1+7 =