Empty string: Difference between revisions
no edit summary
(+add Pike) |
No edit summary |
||
Line 3,098:
False
False</pre>
=={{header|Vlang}}==
<lang vlang>// define and initialize an empty string
mut s := ""
// assign an empty string to a variable
s = ""
// check that a string is empty, any of:
s == ""
s.len() == 0
// check that a string is not empty, any of:
s != ""
s.len() != 0 // or > 0</lang>
::<lang vlang>fn test(s string) {
if s.len() == 0 {
println("empty")
} else {
println("not empty")
}
}
fn main() {
// assign an empty string to a variable.
str1 := ""
str2 := " "
// check if a string is empty.
test(str1) // prt empty
// check that a string is not empty.
test(str2) // prt not empty
}</lang>
=={{header|Wee Basic}}==
|