lcfirst

lcfirst(string)

Returns string with the first character converted to lowercase.

Examples

  1. Convert the first character of a string to lowercase:

    julia> lcfirst("Hello")
    "hello"

    This example converts the first character of the string "Hello" to lowercase.

  2. Handle an empty string:

    julia> lcfirst("")
    ""

    When the input string is empty, the function returns an empty string without any changes.

  3. Preserve the case of subsequent characters:
    julia> lcfirst("JuliaLang")
    "juliaLang"

    The function only converts the first character to lowercase while preserving the case of subsequent characters.

Common mistake example:

julia> lcfirst(123)
ERROR: MethodError: no method matching lcfirst(::Int64)

In this example, the input type is incorrect. The lcfirst function expects a string as input. Make sure to pass a valid string argument to avoid such errors.

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: