<?php

namespace App\Helpers;

class IString
{
    public static function getUpperCaseCharacter($word)
    {
        // $str = preg_replace('/\s+/', '_', $word);
        // example: hello_world  => Hello World
        if($word != "")
        {
            $str        = str_replace('_', ' ', $word);
            $new_str    = ucwords($str);
            return $new_str;
        }
        
        return null; 
    } 

    public static function getUpperCaseFullName($name = null)
    {
        //$name = ['annual_leave','sick_leave','maternity_leave','unpaid_leave'];
        $full_name = [];
        foreach ($name as $item)
        {
            if ($item != null){
                $fn[] = (str_replace('_',' ', $item));
                foreach ($fn as $k => $v){
                     $n = ucwords($v);
                }
                $full_name[$k+1] = $n;
            }else{
                $full_name[] = "";
            }
        }
        return $full_name;
    }
}