lyoutakoduka / spartaproject

MIT License
0 stars 0 forks source link

Add method to replace one or more consecutive split identifier. #73

Closed lyoutakoduka closed 2 months ago

lyoutakoduka commented 3 months ago

Define of words

Target string: "root_body_head" Split Identifier: "_"

Add method to replace one or more consecutive split identifier to single same split identifier.

The method is added to class "SplitIdentifier" in module "split_identifier".

https://github.com/lyoutakoduka/spartaproject/blob/b821aa97aac217d546ffbab462846f24428e33d6/pyspartaproj/script/string/rename/split_identifier.py#L12

Definition of method is follow.

def replace_identifier(self, text: str) -> str:

String "root_body_head" is returned if you call method "replace_identifier" with argument "root_bodyhead".

lyoutakoduka commented 2 months ago

Add method to switch the split identifier to specific character to class "SplitIdentifier".

Definition of method is follow.

def switch_identifier(self, text: str, identifier: str) -> str:

String "root-body-head" is returned if arguments of method "switch_identifier" are follow.

  1. text: "root_body_head"
  2. identifier: "-"
lyoutakoduka commented 2 months ago

About class "StandardizeText" in module "standardize_text", move following arguments of constructor to just before executing.

https://github.com/lyoutakoduka/spartaproject/blob/b821aa97aac217d546ffbab462846f24428e33d6/pyspartaproj/script/string/rename/standardize_text.py#L42

lower: bool
under: bool
strip: bool
replace: bool

Arguments are moved to method "standardize".

https://github.com/lyoutakoduka/spartaproject/blob/b821aa97aac217d546ffbab462846f24428e33d6/pyspartaproj/script/string/rename/standardize_text.py#L22