Skip to content

Commit

Permalink
Update annotated.jl docstrings according to #55741
Browse files Browse the repository at this point in the history
  • Loading branch information
danielwe authored Dec 2, 2024
1 parent 8ce7d0f commit e24a84a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions base/strings/annotated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ like [`string`](@ref) but preserves any annotations present in the arguments.
```julia-repl
julia> AnnotatedString("this is an example annotated string",
[(1:18, :A => 1), (12:28, :B => 2), (18:35, :C => 3)])
[(1:18, :A, 1), (12:28, :B, 2), (18:35, :C, 3)])
"this is an example annotated string"
```
"""
Expand Down Expand Up @@ -88,7 +88,7 @@ AnnotatedChar(s::S, annotations::Vector{$Annotation})
# Examples
```julia-repl
julia> AnnotatedChar('j', :label => 1)
julia> AnnotatedChar('j', (:label, 1))
'j': ASCII/Unicode U+006A (category Ll: Letter, lowercase)
```
"""
Expand Down Expand Up @@ -236,7 +236,7 @@ See also [`AnnotatedString`](@ref) and [`AnnotatedChar`](@ref).
julia> annotatedstring("now a AnnotatedString")
"now a AnnotatedString"
julia> annotatedstring(AnnotatedString("annotated", [(1:9, :label => 1)]), ", and unannotated")
julia> annotatedstring(AnnotatedString("annotated", [(1:9, :label, 1)]), ", and unannotated")
"annotated, and unannotated"
```
"""
Expand Down Expand Up @@ -344,7 +344,7 @@ end
annotate!(str::AnnotatedString, [range::UnitRange{Int}], label::Symbol, value)
annotate!(str::SubString{AnnotatedString}, [range::UnitRange{Int}], label::Symbol, value)
Annotate a `range` of `str` (or the entire string) with a labeled value (`label` => `value`).
Annotate a `range` of `str` (or the entire string) with a labeled value `(label, value)`.
To remove existing `label` annotations, use a value of `nothing`.
The order in which annotations are applied to `str` is semantically meaningful,
Expand All @@ -365,7 +365,7 @@ annotate!(s::SubString{<:AnnotatedString}, label::Symbol, @nospecialize(val::Any
"""
annotate!(char::AnnotatedChar, label::Symbol, value::Any)
Annotate `char` with the pair `label => value`.
Annotate `char` with the labeled value `(label, value)`.
"""
annotate!(c::AnnotatedChar, label::Symbol, @nospecialize(val::Any)) =
(push!(c.annotations, Annotation((; label, val))); c)
Expand Down

0 comments on commit e24a84a

Please sign in to comment.