src/bbn/str.php
public static function change_case($st, $case = 'x'): string
  {
    $st = self::cast($st);
    $case = substr(strtolower((string)$case), 0, 1);
    switch ( $case ){
      case "l":
        $case = MB_CASE_LOWER;
        break;
      case "u":
        $case = MB_CASE_UPPER;
        break;
      default:
        $case = MB_CASE_TITLE;
    }
    if ( !empty($st) ){
      $st = mb_convert_case($st, $case);
    }
    return $st;
  }
public static function change_case($st, $case = 'x'): string
  {
    $st = self::cast($st);
    $case = substr(strtolower((string)$case), 0, 1);
    switch ( $case ){
      case "l":
        $case = MB_CASE_LOWER;
        break;
      case "u":
        $case = MB_CASE_UPPER;
        break;
      default:
        $case = MB_CASE_TITLE;
    }
    if ( !empty($st) ){
      $st = mb_convert_case($st, $case);
    }
    return $st;
  }
public static function change_case ( $ st , $ case = 'x' ) : string { $ st = self :: cast ( $ st ) ; $ case = substr ( strtolower ( ( string ) $ case ) , 0 , 1 ) ; switch ( $ case ) { case "l" : $ case = MB_CASE_LOWER ; break ; case "u" : $ case = MB_CASE_UPPER ; break ; default : $ case = MB_CASE_TITLE ; } if ( ! empty ( $ st ) ) { $ st = mb_convert_case ( $ st , $ case ) ; } return $ st ; }
Converts the case of a string.

```php
$st = 'TEST CASE';
\bbn\x::dump(\bbn\str::change_case($st, 'lower'));
// (string) "test case"
\bbn\x::dump(\bbn\str::change_case('TEsT Case', 'upper'));
// (string) "TEST CASE"
\bbn\x::dump(\bbn\str::change_case('test case'));
// (string) "Test Case"
```

@param mixed $st The item to convert.
@param mixed $case The case to convert to ("lower" or "upper"), default being the title case.
@return string
Converts the case of a string .