This commit is contained in:
2026-07-12 10:48:01 +07:00
parent bd5022c8bc
commit c4eeb99aba
4 changed files with 34 additions and 11 deletions
+2 -2
View File
@@ -2,7 +2,7 @@
julia_version = "1.12.6" julia_version = "1.12.6"
manifest_format = "2.0" manifest_format = "2.0"
project_hash = "d7f9863f8330aa2e4c1c2fe1efc04d3b0e6bb33b" project_hash = "c825feef41198c770952e1181ec41e9f2aa0c3c0"
[[deps.Accessors]] [[deps.Accessors]]
deps = ["CompositionsBase", "ConstructionBase", "Dates", "InverseFunctions", "MacroTools"] 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"] deps = ["CSV", "DataFrames", "DataStructures", "Dates", "Distributions", "HTTP", "JSON", "NATS", "PrettyPrinting", "Random", "Revise", "SHA", "UUIDs"]
path = "." path = "."
uuid = "c6c72f09-b708-4ac8-ac7c-2084d70108fe" uuid = "c6c72f09-b708-4ac8-ac7c-2084d70108fe"
version = "0.4.7" version = "0.4.10"
[[deps.HTTP]] [[deps.HTTP]]
deps = ["Base64", "CodecZlib", "Dates", "EnumX", "PrecompileTools", "Random", "Reseau", "SHA", "URIs", "UUIDs", "Zlib_jll"] deps = ["Base64", "CodecZlib", "Dates", "EnumX", "PrecompileTools", "Random", "Reseau", "SHA", "URIs", "UUIDs", "Zlib_jll"]
+1 -1
View File
@@ -1,6 +1,6 @@
name = "GeneralUtils" name = "GeneralUtils"
uuid = "c6c72f09-b708-4ac8-ac7c-2084d70108fe" uuid = "c6c72f09-b708-4ac8-ac7c-2084d70108fe"
version = "0.4.9" version = "0.4.10"
authors = ["tonaerospace <tonaerospace.etc@gmail.com>"] authors = ["tonaerospace <tonaerospace.etc@gmail.com>"]
[deps] [deps]
+1 -7
View File
@@ -546,13 +546,7 @@ julia> clean_json_response(text)
""" """
function clean_json_response(text::String) function clean_json_response(text::String)
removelist = ["{", "}", "```", "json", "\n"] removelist = ["{", "}", "```", "json", "\n"]
for i in removelist return '{' * removestring(text, removelist) * '}'
while occursin(i, text)
text = replace(text, i => "")
end
end
text = '{' * text * '}'
return text
end end
+30 -1
View File
@@ -5,7 +5,7 @@ export timedifference, showstracktrace, findHighestIndexKey, uuid4snakecase, rep
dataframeToCSV, dfToVectorDict, disintegrate_vectorDict, getDataFrameValue, dfRowtoString, dataframeToCSV, dfToVectorDict, disintegrate_vectorDict, getDataFrameValue, dfRowtoString,
dfToString, dataframe_to_json_list, dictToString, dictToString_noKey, issomething, dfToString, dataframe_to_json_list, dictToString, dictToString_noKey, issomething,
dictToString_numbering, extract_triple_backtick_text, dictToString_numbering, extract_triple_backtick_text,
countGivenWords, remove_french_accents, countGivenWords, remove_french_accents, removestring,
extractTextBetweenCharacter, extractTextBetweenString, extractTextBetweenCharacter, extractTextBetweenString,
convertCamelSnakeKebabCase, fitrange, recentElementsIndex, nonRecentElementsIndex convertCamelSnakeKebabCase, fitrange, recentElementsIndex, nonRecentElementsIndex
@@ -1139,9 +1139,38 @@ function nonRecentElementsIndex(vectorlength::Integer, n::Integer)
return 1:(vectorlength-n) return 1:(vectorlength-n)
end 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