isupper

isupper(c::Union{Char,AbstractString}) -> Bool

Tests whether a character is an uppercase letter, or whether this is true for all elements of a string. A character is classified as uppercase if it belongs to Unicode category Lu, Letter: Uppercase, or Lt, Letter: Titlecase.

Examples

In the Julia programming language, the function isupper(c::Union{Char, AbstractString}) -> Bool is used to determine whether a character is an uppercase letter or if all elements of a string are uppercase letters. The function returns true if the character or all elements of the string are uppercase, and false otherwise.

Examples of how to use isupper function:

  1. Check if a character is uppercase:

    julia> isupper('A')
    true
    
    julia> isupper('a')
    false

    In this example, isupper returns true for an uppercase character 'A' and false for a lowercase character 'a'.

  2. Check if all characters in a string are uppercase:

    julia> isupper("JULIA")
    true
    
    julia> isupper("Julia")
    false

    The isupper function can also be used to check if all characters in a string are uppercase. It returns true if all characters in the string are uppercase and false otherwise.

Common mistake example:

julia> isupper("JULIA!")
ERROR: MethodError: no method matching isupper(::String)

In this example, the isupper function is called with a string that contains non-alphabetic characters. The isupper function can only be used with characters or strings consisting of alphabetic characters.

See Also

ascii, base64decode, Base64DecodePipe, base64encode, Base64EncodePipe, bin, bits, bytestring, charwidth, chomp, chop, chr2ind, contains, endswith, escape_string, graphemes, ind2chr, iscntrl, istext, isupper, isvalid, join, lcfirst, lowercase, lpad, lstrip, normalize_string, num2hex, parseip, randstring, readuntil, replace, repr, rpad, rsplit, rstrip, search, searchindex, split, startswith, string, stringmime, strip, strwidth, summary, takebuf_string, ucfirst, unescape_string, uppercase, utf16, utf32, utf8, wstring,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: