update
This commit is contained in:
@@ -604,12 +604,13 @@ julia> headers = ["Thought", "Act"]
|
||||
function replaceHeaders(text::T, headers, step::Int) where {T<:AbstractString}
|
||||
newtext = text
|
||||
for i in headers
|
||||
header = i[:char][1:end-1]
|
||||
header = i[1:end-1] # not include ":"
|
||||
if occursin(header, newtext)
|
||||
startind = findfirst(i[:char], newtext)[1]
|
||||
startind = findfirst(header, newtext)[1]
|
||||
stopind = findnext(":", newtext, startind+1)[end]
|
||||
word = newtext[startind: stopind]
|
||||
newtext = replace(newtext, word=> "$header $step:")
|
||||
newword = "$header $step:"
|
||||
newtext = replace(newtext, word=> newword)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user