Skip to content

Converts a cursor to a string representation that can be persisted and later restored with am_cursor_from_string().

Usage

am_cursor_to_string(cursor)

Arguments

cursor

An am_cursor object created by am_cursor()

Value

A character string containing the serialized cursor

Examples

doc <- am_create()
am_put(doc, AM_ROOT, "text", am_text("Hello World"))
text_obj <- am_get(doc, AM_ROOT, "text")

cursor <- am_cursor(text_obj, 5)
str <- am_cursor_to_string(cursor)
str
#> [1] "7@0a58889fa33164a36850e487bdcb4121"

# Restore cursor later
restored <- am_cursor_from_string(str, text_obj)
am_cursor_position(restored)  # 5
#> [1] 5

am_close(doc)