iscntrl

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

Tests whether a character is a control character, or whether this is true for all elements of a string. Control characters are the non-printing characters of the Latin-1 subset of Unicode.

Examples

  1. Check if a single character is a control character:

    julia> iscntrl('\t')
    true

    This example checks if the tab character ('\t') is a control character.

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

    julia> iscntrl("Hello\nWorld")
    false

    It checks if all characters in the string "Hello\nWorld" are control characters.

  3. Handle empty strings:
    julia> iscntrl("")
    false

    This example demonstrates that an empty string does not contain any control characters.

Common mistake example:

julia> iscntrl(65)
ERROR: MethodError: no method matching iscntrl(::Int64)

In this example, the input is an integer (65) instead of a character or string. Make sure to provide valid character or string inputs to the iscntrl function.

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: