How to check if the last char of a String is a specific char
<p>I have a funtion in my program that should determine if the last char of a string is a / and if not, add a / at the end, however, it always adds a /, even if the last char is a /
Here is the code:</p>

<pre><code>public static String setLastCharSlash(String check) {
    if(check.substring(check.length() - 1) != "/") {
        check = check + "/";
    }
    return check;
}
</code></pre>