Answers for "check if string is just space scala"

2

javascript check if string ends with

function endsWith(str, suffix) {
    return str.indexOf(suffix, str.length - suffix.length) !== -1;
}

endsWith("hello young man","man");//true
endsWith("hello young man","boy");//false
Posted by: Guest on July-24-2019
0

how to check if a string contains only alphabets and space in java

class IsAlpha
{
    public static boolean isAlpha(String s) {
        if (s == null) {
            return false;
        }
 
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (!(c >= 'A' && c <= 'Z') && !(c >= 'a' && c <= 'z')) {
                return false;
            }
        }
        return true;
    }
 
    public static void main(String[] args)
    {
        String s = "ABCD";
        System.out.println("IsAlpha: " + isAlpha(s));
    }
}
Posted by: Guest on April-30-2020

Code answers related to "check if string is just space scala"

Code answers related to "Javascript"

Browse Popular Code Answers by Language