clipboard

clipboard() -> AbstractString

Return a string with the contents of the operating system clipboard ("paste").

Examples

  1. Copy a string to the clipboard:

    julia> clipboard("Hello, Julia!")

    This example copies the string "Hello, Julia!" to the operating system clipboard.

  2. Copy a numerical value to the clipboard:

    julia> clipboard(42)

    It copies the numerical value 42 to the clipboard.

  3. Copy a variable to the clipboard:

    julia> x = ["apple", "banana", "orange"]
    julia> clipboard(x)

    This example copies the contents of the variable x (an array of strings) to the clipboard.

Common mistake example:

julia> clipboard([1, 2, 3])
ERROR: MethodError: no method matching clipboard(::Array{Int64,1})

In this example, an array of integers is provided as an argument to clipboard, which is not a supported type. The clipboard function in Julia is primarily used for copying strings or printable representations of objects.

See Also

addprocs, atexit, cd, clipboard, EnvHash, exit, getpid, peakflops, ProcessExitedException, process_exited, process_running, procs, quit, readandwrite, redirect_stdout, rmprocs, run, setenv, spawn, withenv,

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: