API

Types

Config

Config

Configuration for the package.

Fields

  • name::String: The name to use in greetings.
  • verbose::Bool: Whether to print extra information.

Functions

greet

greet()
greet(name::String)

Return a greeting string. If name is provided, greet that person.

Examples

julia> greet()
"Hello from JuliaPackageTemplate!"

julia> greet("Julia")
"Hello, Julia!"

transform

transform(x::AbstractVector; scale=1.0)

Apply a transformation to x, scaling each element by scale.

Examples

julia> transform([1, 2, 3]; scale=2.0)
3-element Vector{Float64}:
 2.0
 4.0
 6.0

Constants

DEFAULT_GREETING

String(s::AbstractString)

Create a new String from an existing AbstractString.

String(v::AbstractVector{UInt8})

Create a new String object using the data buffer from byte vector v. If v is a Vector{UInt8} it will be truncated to zero length and future modification of v cannot affect the contents of the resulting string. To avoid truncation of Vector{UInt8} data, use String(copy(v)); for other AbstractVector types, String(v) already makes a copy.

When possible, the memory of v will be used without copying when the String object is created. This is guaranteed to be the case for byte vectors returned by take! on a writable IOBuffer and by calls to read(io, nb). This allows zero-copy conversion of I/O data to strings. In other cases, Vector{UInt8} data may be copied, but v is truncated anyway to guarantee consistent behavior.

String <: AbstractString

The default string type in Julia, used by e.g. string literals.

Strings are immutable sequences of Chars. A String is stored internally as a contiguous byte array, and while they are interpreted as being UTF-8 encoded, they can be composed of any byte sequence. Use isvalid to validate that the underlying byte sequence is valid as UTF-8.