string bytelengthTcl 8.6 only
Gives the count of bytes of the UTF-8 form of a string.
string bytelength STRING
Description
Gives the count of bytes of STRING in UTF-8. A character below U+0080 is one byte, and each other character is two to four bytes.
The subcommand is in Tcl 8.6 only. In Tcl 9.1 use string length [encoding convertto utf-8 STRING].
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| STRING | string | required | The text to measure. |
Returns
A non-negative integer.
Examples
% string bytelength "café"
5
% string bytelength ""
0
Errors
% string bytelength
wrong # args: should be "string bytelength string"
-errorcode TCL WRONGARGS
Facts
- Capability
- None.
- Tcl release
- Tcl 8.6 only.
- Since
- ztcl 1.0.0-beta.1