Skip to content

Commit

Permalink
Shell: renamed all String functions to align with new findings
Browse files Browse the repository at this point in the history
It's better to have the type comes after the library name like
'HestiaKERNEL_ERROR...' or 'HestiaKERNEL_OS...' function names
and filepaths. That way, it's less learning yet tracable by
reading. Hence, let's deal with all the String functions.

This patch renames all String functions to align with new
findings in Shell/ directory.

Co-authored-by: Shuralyov, Jean <jean.shuralyov@proton.me>
Co-authored-by: Galyna, Cory <cory.galyna@gmail.com>
Co-authored-by: (Holloway) Chew, Kean Ho <me@hollowaykeanho.com>
Signed-off-by: (Holloway) Chew, Kean Ho <me@hollowaykeanho.com>
  • Loading branch information
3 people committed Dec 29, 2024
1 parent 7d41d1f commit ca713f1
Show file tree
Hide file tree
Showing 87 changed files with 343 additions and 247 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@



function HestiaKERNEL-To-String-From-Unicode {
function HestiaKERNEL-STRING-From-Unicode {
param (
[uint32[]]$___unicode
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@



HestiaKERNEL_To_String_From_Unicode() {
HestiaKERNEL_STRING_From_Unicode() {
#___unicode="$1"


Expand Down
6 changes: 3 additions & 3 deletions Shell/libraries/HestiaKERNEL/String/Get_First_Character.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
#
# You MUST ensure any interaction with the content STRICTLY COMPLIES with
# the permissions and limitations set forth in the license.
. "${env:LIBS_HESTIA}\HestiaKERNEL\String\To_String_From_Unicode.ps1"
. "${env:LIBS_HESTIA}\HestiaKERNEL\String\From_Unicode.ps1"
. "${env:LIBS_HESTIA}\HestiaKERNEL\Unicode\Get_First_Unicode.ps1"
. "${env:LIBS_HESTIA}\HestiaKERNEL\Unicode\To_Unicode_From_String.ps1"
. "${env:LIBS_HESTIA}\HestiaKERNEL\Unicode\Unicode.ps1"




function HestiaKERNEL-Get-First-Character {
function HestiaKERNEL-STRING-Get-First-Character {
param (
[string]$___input_string
)
Expand All @@ -38,5 +38,5 @@ function HestiaKERNEL-Get-First-Character {


# execute
return HestiaKERNEL-To-String-From-Unicode $___unicode
return HestiaKERNEL-STRING-From-Unicode $___unicode
}
6 changes: 3 additions & 3 deletions Shell/libraries/HestiaKERNEL/String/Get_First_Character.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
# You MUST ensure any interaction with the content STRICTLY COMPLIES with
# the permissions and limitations set forth in the license.
. "${LIBS_HESTIA}/HestiaKERNEL/Error/Codes.sh"
. "${LIBS_HESTIA}/HestiaKERNEL/String/To_String_From_Unicode.sh"
. "${LIBS_HESTIA}/HestiaKERNEL/String/From_Unicode.sh"
. "${LIBS_HESTIA}/HestiaKERNEL/Unicode/Get_First_Unicode.sh"
. "${LIBS_HESTIA}/HestiaKERNEL/Unicode/To_Unicode_From_String.sh"
. "${LIBS_HESTIA}/HestiaKERNEL/Unicode/Unicode.sh"




HestiaKERNEL_Get_First_Character() {
HestiaKERNEL_STRING_Get_First_Character() {
#___input_string="$1"


Expand All @@ -37,7 +37,7 @@ HestiaKERNEL_Get_First_Character() {
fi

___unicode="$(HestiaKERNEL_Get_First_Unicode "$___unicodes")"
printf -- "%s" "$(HestiaKERNEL_To_String_From_Unicode "$___unicode")"
printf -- "%s" "$(HestiaKERNEL_STRING_From_Unicode "$___unicode")"
if [ $? -ne $HestiaKERNEL_ERROR_OK ]; then
return $HestiaKERNEL_ERROR_BAD_EXEC
fi
Expand Down
6 changes: 3 additions & 3 deletions Shell/libraries/HestiaKERNEL/String/Get_Last_Character.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
#
# You MUST ensure any interaction with the content STRICTLY COMPLIES with
# the permissions and limitations set forth in the license.
. "${env:LIBS_HESTIA}\HestiaKERNEL\String\To_String_From_Unicode.ps1"
. "${env:LIBS_HESTIA}\HestiaKERNEL\String\From_Unicode.ps1"
. "${env:LIBS_HESTIA}\HestiaKERNEL\Unicode\Get_Last_Unicode.ps1"
. "${env:LIBS_HESTIA}\HestiaKERNEL\Unicode\To_Unicode_From_String.ps1"
. "${env:LIBS_HESTIA}\HestiaKERNEL\Unicode\Unicode.ps1"




function HestiaKERNEL-Get-Last-Character {
function HestiaKERNEL-STRING-Get-Last-Character {
param (
[string]$___input_string
)
Expand All @@ -38,5 +38,5 @@ function HestiaKERNEL-Get-Last-Character {


# execute
return HestiaKERNEL-To-String-From-Unicode $___unicode
return HestiaKERNEL-STRING-From-Unicode $___unicode
}
6 changes: 3 additions & 3 deletions Shell/libraries/HestiaKERNEL/String/Get_Last_Character.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
# You MUST ensure any interaction with the content STRICTLY COMPLIES with
# the permissions and limitations set forth in the license.
. "${LIBS_HESTIA}/HestiaKERNEL/Error/Codes.sh"
. "${LIBS_HESTIA}/HestiaKERNEL/String/To_String_From_Unicode.sh"
. "${LIBS_HESTIA}/HestiaKERNEL/String/From_Unicode.sh"
. "${LIBS_HESTIA}/HestiaKERNEL/Unicode/Get_Last_Unicode.sh"
. "${LIBS_HESTIA}/HestiaKERNEL/Unicode/To_Unicode_From_String.sh"
. "${LIBS_HESTIA}/HestiaKERNEL/Unicode/Unicode.sh"




HestiaKERNEL_Get_Last_Character() {
HestiaKERNEL_STRING_Get_Last_Character() {
#___input_string="$1"


Expand All @@ -37,7 +37,7 @@ HestiaKERNEL_Get_Last_Character() {
fi

___unicode="$(HestiaKERNEL_Get_Last_Unicode "$___unicodes")"
printf -- "%s" "$(HestiaKERNEL_To_String_From_Unicode "$___unicode")"
printf -- "%s" "$(HestiaKERNEL_STRING_From_Unicode "$___unicode")"
if [ $? -ne $HestiaKERNEL_ERROR_OK ]; then
return $HestiaKERNEL_ERROR_BAD_EXEC
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@



function HestiaKERNEL-Get-Length-String {
function HestiaKERNEL-STRING-Get-Length {
param (
[string]$___input_string
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@



HestiaKERNEL_Get_Length_String() {
HestiaKERNEL_STRING_Get_Length() {
#___input_string="$1"


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@



function HestiaKERNEL-Has-String {
function HestiaKERNEL-STRING-Has {
param (
[string]$___input,
[string]$___target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@



HestiaKERNEL_Has_String() {
HestiaKERNEL_STRING_Has() {
#___input="$1"
#___target="$2"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@



function HestiaKERNEL-Has-Any-String {
function HestiaKERNEL-STRING-Has-Any {
param (
[string]$___input,
[string]$___target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@



HestiaKERNEL_Has_Any_String() {
HestiaKERNEL_STRING_Has_Any() {
#___input="$1"
#___target="$2"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@



function HestiaKERNEL-Index-String {
function HestiaKERNEL-STRING-Index {
param (
[string]$___input,
[string]$___target,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@



HestiaKERNEL_Index_String() {
HestiaKERNEL_STRING_Index() {
#___input="$1"
#___target="$2"
#___from_right="$3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@



function HestiaKERNEL-Index-Any-String {
function HestiaKERNEL-STRING-Index-Any {
param (
[string]$___input,
[string]$___target,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@



HestiaKERNEL_Index_Any_String() {
HestiaKERNEL_STRING_Index_Any() {
#___input="$1"
#___target="$2"
#___from_right="$3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@



function HestiaKERNEL-Index-Any-Left-String {
function HestiaKERNEL-STRING-Index-Any-Left {
param (
[string]$___input,
[string]$___target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@



HestiaKERNEL_Index_Any_Left_String() {
HestiaKERNEL_STRING_Index_Any_Left() {
#___input="$1"
#___target="$2"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@



function HestiaKERNEL-Index-Any-Right-String {
function HestiaKERNEL-STRING-Index-Any-Right {
param (
[string]$___input,
[string]$___target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@



HestiaKERNEL_Index_Any_Right_String() {
HestiaKERNEL_STRING_Index_Any_Right() {
#___input="$1"
#___target="$2"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@



function HestiaKERNEL-Index-Left-String {
function HestiaKERNEL-STRING-Index-Left {
param (
[string]$___input,
[string]$___target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@



HestiaKERNEL_Index_Left_String() {
HestiaKERNEL_STRING_Index_Left() {
#___input="$1"
#___target="$2"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@



function HestiaKERNEL-Index-Right-String {
function HestiaKERNEL-STRING-Index-Right {
param (
[string]$___input,
[string]$___target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@



HestiaKERNEL_Index_Right_String() {
HestiaKERNEL_STRING_Index_Right() {
#___input="$1"
#___target="$2"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# directly such that:
# (1) POSIX Compliant Shell : if [ "$var" = "" ]; then
# (2) PowerShell : if ($var -eq "") {
function HestiaKERNEL-Is-Empty-String {
function HestiaKERNEL-STRING-Is-Empty {
param (
[string]$___target
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# directly such that:
# (1) POSIX Compliant Shell : if [ "$var" = "" ]; then
# (2) PowerShell : if ($var -eq "") {
HestiaKERNEL_Is_Empty_String() {
HestiaKERNEL_STRING_Is_Empty() {
#___target="$1"


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@



function HestiaKERNEL-Is-Punctuation-String {
function HestiaKERNEL-STRING-Is-Punctuation {
param (
[string]$___rune
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@



HestiaKERNEL_Is_Punctuation_String() {
HestiaKERNEL_STRING_Is_Punctuation() {
#___rune="$1"


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@



function HestiaKERNEL-Is-Whitespace-String {
function HestiaKERNEL-STRING-Is-Whitespace {
param (
[string]$___rune
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@



HestiaKERNEL_Is_Whitespace_String() {
HestiaKERNEL_STRING_Is_Whitespace() {
#___rune="$1"


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
#
# You MUST ensure any interaction with the content STRICTLY COMPLIES with
# the permissions and limitations set forth in the license.
. "${env:LIBS_HESTIA}\HestiaKERNEL\String\To_String_From_Unicode.ps1"
. "${env:LIBS_HESTIA}\HestiaKERNEL\String\From_Unicode.ps1"
. "${env:LIBS_HESTIA}\HestiaKERNEL\Unicode\Replace_Unicode.ps1"
. "${env:LIBS_HESTIA}\HestiaKERNEL\Unicode\To_Unicode_From_String.ps1"




function HestiaKERNEL-Replace-String {
function HestiaKERNEL-STRING-Replace {
param (
[string]$___input,
[string]$___from,
Expand All @@ -39,5 +39,5 @@ function HestiaKERNEL-Replace-String {


# report status
return HestiaKERNEL-To-String-From-Unicode $___content
return HestiaKERNEL-STRING-From-Unicode $___content
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
#
# You MUST ensure any interaction with the content STRICTLY COMPLIES with
# the permissions and limitations set forth in the license.
. "${LIBS_HESTIA}/HestiaKERNEL/String/To_String_From_Unicode.sh"
. "${LIBS_HESTIA}/HestiaKERNEL/String/From_Unicode.sh"
. "${LIBS_HESTIA}/HestiaKERNEL/Unicode/Replace_Unicode.sh"
. "${LIBS_HESTIA}/HestiaKERNEL/Unicode/To_Unicode_From_String.sh"




HestiaKERNEL_Replace_String() {
HestiaKERNEL_STRING_Replace() {
#___input="$1"
#___from="$2"
#___to="$3"
Expand All @@ -39,6 +39,6 @@ HestiaKERNEL_Replace_String() {


# report status
printf -- "%b" "$(HestiaKERNEL_To_String_From_Unicode "$___content")"
printf -- "%b" "$(HestiaKERNEL_STRING_From_Unicode "$___content")"
return $?
}
Loading

0 comments on commit ca713f1

Please sign in to comment.