Library reference

Check for empty text

An empty string has no characters. A space is still a character.

isempty

Simple example

Is a string with no characters empty?

Start''
Resulttrue
lesson.jl
function main()
    println(isempty(""))
end

main()
Output
true
Advertisements

Everyday examples

A library card has no name entered. Should the form ask for one?

Start''
Resulttrue
lesson.jl
function main()
    println(isempty(""))
end

main()
Output
true

A passenger typed a space in the seat field. Is the raw field empty?

Start' '
Resultfalse
lesson.jl
function main()
    println(isempty(" "))
end

main()
Output
false

The classroom screen says Ready. Is the message empty?

Start'Ready'
Resultfalse
lesson.jl
function main()
    println(isempty("Ready"))
end

main()
Output
false
Run the example
Terminal
julia lesson.jl
Official documentation