This commit is contained in:
2023-12-03 14:41:56 +00:00
parent 07555c2613
commit e6c464c96e
3 changed files with 30 additions and 23 deletions

View File

@@ -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