User Tools

Site Tools


en:serialize

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:serialize [2016/09/08 13:48]
admin
en:serialize [2020/02/28 10:46] (current)
Line 2: Line 2:
  
 ==== Format ==== ==== Format ====
-**serialize** ( [[arrays|array]] )\\+**serialize** ( [[arrays|variable[]]] )\\
 **serialize** ( [[Lists|{ x1, y1, x2, y2, x3, y3 ... }]] ) **serialize** ( [[Lists|{ x1, y1, x2, y2, x3, y3 ... }]] )
  
Line 15: Line 15:
 === Format of the Serialized Array === === Format of the Serialized Array ===
  
-The string representing the array's data is a series of values separated by a colon ':' The first value represents the number of rows and the second the number of columns.  A one dimensional array will have a single row (1), with the length in the second value.  The elements of the array follow.  The first character of each value contains a type (0-unassigned, 1-integer, 2-float, and 3-string) and the actual array data follows.  Strings are converted to hexadecimal so that any Unicode or special characters will be stored without change.  The strings returned will contain ONLY ':', '.', '0'-'9', and 'a'-'f'.+The string representing the array's data is a series of values separated by a colon ':' The first value represents the number of rows and the second the number of columns.  A one dimensional array will have a single row (1), with the length in the second value.  The elements of the array follow.  The first character of each value contains a marker byte defining the data type ('0'-unassigned, '1'-integer, '2'-float, and '3'-string).  The actual array data follows.  Strings are converted to hexadecimal so that any Unicode or special characters will be stored without change.  The strings returned will contain ONLY ':', '.', '0'-'9', and 'a'-'f'.
  
 The array {1,2,3,4,5.555,"six"} would be serialized to "1:6:11:12:13:14:25.555:3736978" and the array {{1,2},{3,4}} would be serialized to "2:2:11:12:13:14". The array {1,2,3,4,5.555,"six"} would be serialized to "1:6:11:12:13:14:25.555:3736978" and the array {{1,2},{3,4}} would be serialized to "2:2:11:12:13:14".
Line 27: Line 27:
 a[1,2] = 1.234 a[1,2] = 1.234
  
-stuff = serialize(a)+stuff = serialize(a[])
 print stuff print stuff
  
Line 43: Line 43:
 ==== History ====  ==== History ==== 
 |1.99.99.66|New to Version| |1.99.99.66|New to Version|
 +|1.99.99.72|added required [] to passing variable array|
en/serialize.1473364100.txt.gz ยท Last modified: 2020/02/28 10:46 (external edit)