update
This commit is contained in:
+2
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
julia_version = "1.12.6"
|
||||
manifest_format = "2.0"
|
||||
project_hash = "d7f9863f8330aa2e4c1c2fe1efc04d3b0e6bb33b"
|
||||
project_hash = "c825feef41198c770952e1181ec41e9f2aa0c3c0"
|
||||
|
||||
[[deps.Accessors]]
|
||||
deps = ["CompositionsBase", "ConstructionBase", "Dates", "InverseFunctions", "MacroTools"]
|
||||
@@ -229,7 +229,7 @@ version = "1.11.0"
|
||||
deps = ["CSV", "DataFrames", "DataStructures", "Dates", "Distributions", "HTTP", "JSON", "NATS", "PrettyPrinting", "Random", "Revise", "SHA", "UUIDs"]
|
||||
path = "."
|
||||
uuid = "c6c72f09-b708-4ac8-ac7c-2084d70108fe"
|
||||
version = "0.4.7"
|
||||
version = "0.4.10"
|
||||
|
||||
[[deps.HTTP]]
|
||||
deps = ["Base64", "CodecZlib", "Dates", "EnumX", "PrecompileTools", "Random", "Reseau", "SHA", "URIs", "UUIDs", "Zlib_jll"]
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
name = "GeneralUtils"
|
||||
uuid = "c6c72f09-b708-4ac8-ac7c-2084d70108fe"
|
||||
version = "0.4.9"
|
||||
version = "0.4.10"
|
||||
authors = ["tonaerospace <tonaerospace.etc@gmail.com>"]
|
||||
|
||||
[deps]
|
||||
|
||||
+1
-7
@@ -546,13 +546,7 @@ julia> clean_json_response(text)
|
||||
"""
|
||||
function clean_json_response(text::String)
|
||||
removelist = ["{", "}", "```", "json", "\n"]
|
||||
for i in removelist
|
||||
while occursin(i, text)
|
||||
text = replace(text, i => "")
|
||||
end
|
||||
end
|
||||
text = '{' * text * '}'
|
||||
return text
|
||||
return '{' * removestring(text, removelist) * '}'
|
||||
end
|
||||
|
||||
|
||||
|
||||
+30
-1
@@ -5,7 +5,7 @@ export timedifference, showstracktrace, findHighestIndexKey, uuid4snakecase, rep
|
||||
dataframeToCSV, dfToVectorDict, disintegrate_vectorDict, getDataFrameValue, dfRowtoString,
|
||||
dfToString, dataframe_to_json_list, dictToString, dictToString_noKey, issomething,
|
||||
dictToString_numbering, extract_triple_backtick_text,
|
||||
countGivenWords, remove_french_accents,
|
||||
countGivenWords, remove_french_accents, removestring,
|
||||
extractTextBetweenCharacter, extractTextBetweenString,
|
||||
convertCamelSnakeKebabCase, fitrange, recentElementsIndex, nonRecentElementsIndex
|
||||
|
||||
@@ -1139,9 +1139,38 @@ function nonRecentElementsIndex(vectorlength::Integer, n::Integer)
|
||||
return 1:(vectorlength-n)
|
||||
end
|
||||
|
||||
""" Remove specified substrings from text.
|
||||
|
||||
Removes all occurrences of each string in `removelist` from the input text
|
||||
by repeatedly replacing them with empty strings until none remain.
|
||||
|
||||
# Arguments
|
||||
- `text::String`
|
||||
The input string to modify.
|
||||
- `removelist::Vector{String}`
|
||||
A vector of substrings to remove from the text.
|
||||
|
||||
# Return
|
||||
- `String`: The text with all specified substrings removed.
|
||||
|
||||
# Examples
|
||||
```jldoctest
|
||||
julia> using GeneralUtils
|
||||
julia> removestring("hello world", ["l", " "])
|
||||
"heoword"
|
||||
julia> removestring("foo bar baz", ["bar", " "])
|
||||
"foobaz"
|
||||
```
|
||||
"""
|
||||
function removestring(text::String, removelist::Vector{String})::String
|
||||
for i in removelist
|
||||
while occursin(i, text)
|
||||
text = replace(text, i => "")
|
||||
end
|
||||
end
|
||||
|
||||
return string(text)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user