This shows you the differences between two versions of the page.
en:serialize [2016/11/07 12:18] admin |
en:serialize [2020/02/28 10:46] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Serialize (Function) ===== | ||
- | ==== Format ==== | ||
- | **serialize** ( [[arrays|array[]]] )\\ | ||
- | **serialize** ( [[Lists|{ x1, y1, x2, y2, x3, y3 ... }]] ) | ||
- | |||
- | returns [[stringexpressions|string_expression]] | ||
- | |||
- | ==== Description ==== | ||
- | |||
- | The serialize statement creates a string that encodes the dimensions, types, and values in an array. | ||
- | |||
- | Often developers will create a serialized string so that they may save the values in an array into a data file or a database table. | ||
- | |||
- | === Format of the Serialized Array === | ||
- | |||
- | The string representing the array' | ||
- | |||
- | The array {1, | ||
- | ==== Example ==== | ||
- | < | ||
- | dim a(3,4) | ||
- | a[0,0] = 0 | ||
- | a[1,1] = 1 | ||
- | a[2,2] = 2 | ||
- | a[0,1] = ' | ||
- | a[1,2] = 1.234 | ||
- | |||
- | stuff = serialize(a[]) | ||
- | print stuff | ||
- | |||
- | dim c = unserialize(stuff) | ||
- | # the array c is an exact copy of the array a | ||
- | </ | ||
- | will display | ||
- | < | ||
- | 3: | ||
- | </ | ||
- | |||
- | ==== See Also ==== | ||
- | {{page> | ||
- | |||
- | ==== History ==== | ||
- | |1.99.99.66|New to Version| | ||
- | |1.99.99.72|added required [] to passing variable array| |