mark

..  mark(s)

Add a mark at the current position of stream ``s``.  Returns the marked position.

See also :func:`unmark`, :func:`reset`, :func:`ismarked`

Examples

mark(s)

Add a mark at the current position of stream `s`. Returns the marked position.

julia> io = IOBuffer("Hello, World!") julia> mark(io) 6


In this example, `mark` is used to add a mark at the current position of the stream `io`, which is an `IOBuffer` containing the text "Hello, World!". The function returns the marked position, which is 6 in this case.

```julia
unmark(s)

Remove the mark from stream `s`. Returns nothing.

julia> io = IOBuffer("Hello, World!") julia> mark(io) 6 julia> unmark(io)


Here, `unmark` is used to remove the previously added mark from the stream `io`. It does not return anything.

```julia
reset(s)

Reset the position of stream `s` to the marked position. Returns nothing.

julia> io = IOBuffer("Hello, World!") julia> mark(io) 6 julia> seekstart(io) julia> reset(io)


The `reset` function is used to reset the position of the stream `io` to the previously marked position. In this example, `seekstart` is used to move the position to the start of the stream before calling `reset`.

```julia
ismarked(s)

Check if a mark is set on stream `s`. Returns a boolean value.

julia> io = IOBuffer("Hello, World!") julia> mark(io) 6 julia> ismarked(io) true julia> seekstart(io) julia> ismarked(io) false



In this example, `ismarked` is used to check if a mark is set on the stream `io`. It returns `true` if there is a mark, and `false` otherwise.

See Also

deserialize, eachline, eof, fd, flush, IOBuffer, ismarked, isopen, isreadonly, mark, nb_available, open, pipeline, position, read, read!, readavailable, readbytes, readbytes!, readline, redirect_stderr, redirect_stdin, reset, seek, seekend, seekstart, serialize, skip, skipchars, TextDisplay, unmark, write, writemime,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: