String length: Difference between revisions
added OpenEdge solution
(→Character Length: raw utf8 example) |
(added OpenEdge solution) |
||
Line 926:
This gives the number of bytes, not of characters. e.g. length("è") is 2 when "è" is encoded e.g. as UTF-8.
=={{header|OpenEdge/Progress}}==
The codepage can be set independently for input / output and internal operations. The following examples are started from an iso8859-1 session and therefore need to use fix-codepage to adjust the string to utf-8.
===Character Length===
<lang progress>DEF VAR lcc AS LONGCHAR.
FIX-CODEPAGE( lcc ) = "UTF-8".
lcc = "møøse".
MESSAGE LENGTH( lcc ) VIEW-AS ALERT-BOX.</lang>
===Byte Length===
<lang progress>DEF VAR lcc AS LONGCHAR.
FIX-CODEPAGE( lcc ) = "UTF-8".
lcc = "møøse".
MESSAGE LENGTH( lcc, "RAW" ) VIEW-AS ALERT-BOX.</lang>
=={{header|Oz}}==
|