Least used delimiter character in normal text < ASCII 128

后端 未结 14 1445
执念已碎
执念已碎 2020-12-23 19:00

For coding reasons which would horrify you (I\'m too embarrassed to say), I need to store a number of text items in a single string.

I will delimit them using a char

14条回答
  •  执念已碎
    2020-12-23 19:16

    I would choose "Unit Separator" ASCII code "US": ASCII 31 (0x1F)

    In the old, old days, most things were done serially, without random access. This meant that a few control codes were embedded into ASCII.

    ASCII 28 (0x1C) File Separator - Used to indicate separation between files on a data input stream.
    ASCII 29 (0x1D) Group Separator - Used to indicate separation between tables on a data input stream (called groups back then).
    ASCII 30 (0x1E) Record Separator - Used to indicate separation between records within a table (within a group).  These roughly map to a tuple in modern nomenclature.
    ASCII 31 (0x1F) Unit Separator - Used to indicate separation between units within a record.  The roughly map to fields in modern nomenclature.
    

    Unit Separator is in ASCII, and there is Unicode support for displaying it (typically a "us" in the same glyph) but many fonts don't display it.

    If you must display it, I would recommend displaying it in-application, after it was parsed into fields.

提交回复
热议问题