Java String Case Insert invertString(String s)

Here you can find the source of invertString(String s)

Description

Reverse a given String.

License

Open Source License

Parameter

Parameter Description
s The String to reverse.

Return

The reversed string.

Declaration

public static String invertString(String s) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/* w  w  w.ja va 2s .  co  m*/
      *  Reverse a given String.
      *
      * @param s The String to reverse.
      * @return The reversed string.
      */
    public static String invertString(String s) {
        if ((s == null) || (s == ""))
            return "";
        byte[] b = s.getBytes();
        byte[] c = new byte[b.length];
        int x = b.length;
        for (int i = 0; i < x; i++)
            c[x - i - 1] = b[i];
        return new String(c);
    }
}

Related

  1. inverter(String str)
  2. inverter(String string)
  3. inverterString(String palavra)
  4. invertHostName(String hostNameIn)
  5. invertKanaCase(String result)