add GeneralUtils dependency
This commit is contained in:
@@ -301,28 +301,28 @@ function identifyUserIntention(a::agent, usermsg::String)
|
||||
error("undefined condition $(@__LINE__)")
|
||||
end
|
||||
end
|
||||
answer = result === nothing ? nothing : getStringBetweenCharacters(result, "{", "}")
|
||||
answer = result === nothing ? nothing : GeneralUtils.getStringBetweenCharacters(result, "{", "}")
|
||||
|
||||
return answer
|
||||
end
|
||||
|
||||
|
||||
|
||||
function getStringBetweenCurlyBraces(s::AbstractString)
|
||||
m = match(r"\{(.+?)\}", s)
|
||||
m = m == "" ? "" : m.captures[1]
|
||||
return m
|
||||
end
|
||||
# function getStringBetweenCurlyBraces(s::AbstractString)
|
||||
# m = match(r"\{(.+?)\}", s)
|
||||
# m = m == "" ? "" : m.captures[1]
|
||||
# return m
|
||||
# end
|
||||
|
||||
function getStringBetweenCharacters(text::AbstractString, startChar::String, endChar::String)
|
||||
startIndex= findlast(startChar, text)
|
||||
endIndex= findlast(endChar, text)
|
||||
if startIndex === nothing || endIndex === nothing
|
||||
return nothing
|
||||
else
|
||||
return text[startIndex.stop+1: endIndex.start-1]
|
||||
end
|
||||
end
|
||||
# function getStringBetweenCharacters(text::AbstractString, startChar::String, endChar::String)
|
||||
# startIndex= findlast(startChar, text)
|
||||
# endIndex= findlast(endChar, text)
|
||||
# if startIndex === nothing || endIndex === nothing
|
||||
# return nothing
|
||||
# else
|
||||
# return text[startIndex.stop+1: endIndex.start-1]
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user