String length: Difference between revisions
Content added Content deleted
MaiconSoft (talk | contribs) (Added Delphi reference to Pascal code) |
m (→{{header|Phix}}: added syntax colouring the hard way, phix/basics) |
||
Line 2,304: | Line 2,304: | ||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
{{libheader|Phix/basics}} |
|||
The standard length function returns the number of bytes, character length is achieved by converting to utf32 |
The standard length function returns the number of bytes, character length is achieved by converting to utf32 |
||
<!--<lang Phix>--> |
|||
<lang Phix>constant s = "𝔘𝔫𝔦𝔠𝔬𝔡𝔢" |
|||
<span style="color: #008080;">constant</span> <span style="color: #000000;">s</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"𝔘𝔫𝔦𝔠𝔬𝔡𝔢"</span> |
|||
?length(s) |
|||
<span style="color: #0000FF;">?<span style="color: #7060A8;">length<span style="color: #0000FF;">(<span style="color: #000000;">s<span style="color: #0000FF;">)</span> |
|||
?length(utf8_to_utf32(s))</lang> |
|||
<span style="color: #0000FF;">?<span style="color: #7060A8;">length<span style="color: #0000FF;">(<span style="color: #000000;">utf8_to_utf32<span style="color: #0000FF;">(<span style="color: #000000;">s<span style="color: #0000FF;">)<span style="color: #0000FF;">) |
|||
<!--</lang>--> |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |