Is there a technical name for this concept of parsing a string with sizes?

非 Y 不嫁゛ 提交于 2019-12-06 12:27:15

Of standard/established types of serialization, the closest that I'm familiar with is type-length-value (TLV) encoding, which differs from your scheme in that it supports the use of non-fixed types, whereas yours would require the type of each field to be known in advance (and indeed, you seem to use only strings, in all fields).

The FORTRAN language's syntax had Hollerith constants, sometimes called Hollerith strings. They are identical to your example other than using the letter H instead of |.

This is called marshalling.

Doing this generic type of data handling has been around as long as computer science itself. It goes by different names, but the idea of it all has to do with the ability to handle larger amounts of data at once for efficiency-sake (usually increasing speed via less disk i-o). Notable examples within Delphi include TMemo.Text and even before Delphi, the TEXT or TEXTFILE type within Turbo/Borland Pascal. Behind the scenes, this type pulls back "text data" and then parses it out in such a manner as you are describing. As a stream (the way files are processed anyway), standard Windows text files have #13#10 as delimiters, which can be parsed to determine where string breaks occur in text.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!