Changes between Version 2 and Version 3 of StringAPI


Ignore:
Timestamp:
2009-05-02T12:28:20Z (15 years ago)
Author:
Jiri Svoboda
Comment:

String metrics

Legend:

Unmodified
Added
Removed
Modified
  • StringAPI

    v2 v3  
    55 * [#CharacterRepertoire Character Repertoire and Encoding]
    66 * [#StringMetrics String Metrics]
     7 * [#PrefixFunctions Functions Operating on Prefixes]
    78 * [#EncodingDecoding Encoding and Decoding a Character]
    89 * [#OutputBuffers Output Buffers]
     
    2122== String Metrics == #StringMetrics
    2223
    23  * Size
    24  * Length
    25  * Width
     24Unlike with an 8-bit encoding, there is not a 1:1:1 mapping between bytes in memory, characters and display cells on a monospace display. Therefore, three different metrics are needed:
     25
     26 * ''Size'' is the number of bytes to which the string is encoded, ''excluding'' the null terminator.
     27 * ''Length'' is the number of ''characters'' in the string (i.e. the number of times we need to call str_decode() or chr_encode()). Again the null terminator is not counted.
     28 * ''Width'' is the number of display cells on a monospace display the string will be rendered to.
    2629
    2730== Encoding and Decoding a Character == #EncodingDecoding
     
    3942
    4043== Function Reference == #FunctionReference
     44
     45Some functions operate on string prefixes. These have a name like `str_[n|l|w]op()`. Such a function only uses a prefix of the string limited by a metric, `n` for size, `l` for length, `w` for width.
    4146
    4247 * str_size()