@@ -109,8 +109,20 @@ StrUtility::rmAllBlanks(string $string): string
109109StrUtility::alternate(?string $string, string $alternate = null): string
110110```
111111
112- - translation methods, must create lang folder in root of project like lang/\< dirname\>
113- translate('app.title') reference to lang/en/app.php and title array key in app.php.
112+ - translation methods, for using this method you should create a wrapper function
113+ for example
114+
115+ ```
116+ function <your_wrapper_function_name>(string $key, string $replace = '', string $dirName = 'en')
117+ {
118+ $BASE_PATH = // base (root) path of your project
119+
120+ $translatePath = StrUtility::translatePath($BASE_PATH, $dirName);
121+ return StrUtility::translate($translatePath . $key, $replace);
122+ }
123+ ```
124+
125+ < your_wrapper_function_name>('app.title') reference to lang/en/app.php and title array key in app.php
114126file app.php must only return associative array.
115127
116128``` php
@@ -123,7 +135,7 @@ StrUtility::translate(string $key, string $replace = '', string $dirName = 'en')
123135StrUtility::wrapper(int|string $string, int|string $wrapper = '*'): string
124136```
125137
126- - return path of file from root of project
138+ - return path of file
127139
128140``` php
129141StrUtility::filePath(string $path, string $pathExtension = 'php'): string
@@ -320,6 +332,23 @@ StrUtility::incrementBy(string $string, ?string $separator = null): string
320332StrUtility::decrementBy(string $string, ?string $separator = null): string
321333```
322334
335+ - remove last word from given string
336+
337+ ``` php
338+ StrUtility::rmLastWord(string $string): string
339+ ```
340+
341+ - remove first word from given string
342+
343+ ``` php
344+ StrUtility::rmFirstWord(string $string): string
345+ ```
346+
347+ - find whether the type of a given string is slug
348+
349+ ``` php
350+ StrUtility::is_slug(string $slug): bool
351+ ```
323352## PhpStringHelpers usage
324353
325354String helper functions are global so usage like the following:
0 commit comments