String length: Difference between revisions

oberon-2
(oberon-2)
Line 481:
{{needs-review|mIRC Scripting Language}}
alias stringlength { echo -a Your Name is: $len($$?="Whats your name") letters long! }
 
=={{header|Oberon-2}}==
 
===Byte Length===
<pre>
MODULE Size;
 
IMPORT Out;
 
VAR s: LONGINT;
string: ARRAY 5 OF CHAR;
 
BEGIN
string := "Foo";
s := LEN(string);
Out.String("Size: ");
Out.LongInt(s,0);
Out.Ln;
END Size.
</pre>
 
Output:
<pre>
Size: 5
</pre>
 
===Character Length===
<pre>
MODULE Length;
 
IMPORT Out, Strings;
 
VAR l: INTEGER;
string: ARRAY 5 OF CHAR;
 
BEGIN
string := "Foo";
l := Strings.Length(string);
Out.String("Length: ");
Out.Int(l,0);
Out.Ln;
END Length.
</pre>
 
Output:
<pre>
Length: 3
</pre>
 
=={{header|Objective-C}}==
Anonymous user