String length: Difference between revisions
Add Ecstasy example
m (→{{header|Wren}}: Changed to Wren S/H) |
(Add Ecstasy example) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 585:
<syntaxhighlight lang="qbasic"> INPUT a$
PRINT LEN(a$)</syntaxhighlight>
==={{header|ANSI BASIC}}===
The ANSI BASIC needs line numbers.
<syntaxhighlight lang="basic">
10 INPUT A$
20 PRINT LEN(A$)
</syntaxhighlight>
==={{header|Applesoft BASIC}}===
Line 1,289 ⟶ 1,296:
print len "😀"
</syntaxhighlight>
=={{header|Ecstasy}}==
<syntaxhighlight lang="ecstasy">
module StrLen {
@Inject Console console;
void run(String s = "José") {
console.print($|For the string {s.quoted()}:
| Character length: {s.size}
| UTF-8 byte length: {s.calcUtf8Length()}
);
}
}
</syntaxhighlight>
{{out}}
<pre>
For the string "José":
Character length: 4
UTF-8 byte length: 5
</pre>
=={{header|Elena}}==
Line 3,685 ⟶ 3,713:
di ustrlen(s)
47</syntaxhighlight>
=={{header|Stringle}}==
The only current implementation of Stringle uses 8-bit character sets, meaning character and byte length is always the same.
This prints the length of a string from input:
<syntaxhighlight lang="stringle">$ #$</syntaxhighlight>
=={{header|Swift}}==
|