mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 23:05:49 +00:00
20240620_163545
This commit is contained in:
parent
d9a4724a3d
commit
e3c9c9dd92
1 changed files with 12 additions and 10 deletions
|
@ -16,16 +16,18 @@ declare -A char_replacements=(
|
||||||
)
|
)
|
||||||
|
|
||||||
scrub_string() {
|
scrub_string() {
|
||||||
local string=$1
|
local string=$1
|
||||||
# Replace characters
|
# Replace characters
|
||||||
for char in "${!char_replacements[@]}"; do
|
for char in "${!char_replacements[@]}"; do
|
||||||
string=${string//"$char"/"${char_replacements[$char]}"}
|
string=${string//"$char"/"${char_replacements[$char]}"}
|
||||||
done
|
done
|
||||||
# Replace multiple underscores with a single underscore
|
# Replace multiple underscores with a single underscore
|
||||||
string=$(echo "$string" | sed 's/[_]\{2,\}/_/g')
|
string=$(echo "$string" | sed 's/[_]\{2,\}/_/g')
|
||||||
# Remove leading and trailing underscores
|
# Remove leading and trailing underscores
|
||||||
string=$(echo "$string" | sed 's/^_//;s/_$//')
|
string=$(echo "$string" | sed 's/^_//;s/_$//')
|
||||||
echo "$string"
|
# Convert to lowercase
|
||||||
|
string=$(echo "$string" | tr '[:upper:]' '[:lower:]')
|
||||||
|
echo "$string"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Iterate through environment variables
|
# Iterate through environment variables
|
||||||
|
|
Loading…
Reference in a new issue