Retrieving Categories based on the first character of the name

Found a solution.

I found a function that answered my question.

Here is the function:

   function get_category_by_letter($letter) {
     $args=array(
       'orderby' => 'name',
       'order' => 'ASC',
       'hide_empty' => 0);
       $categories=get_categories($args);

    foreach($categories as $category) {
       $catname = $category->name;
       $first_letter = substr(strip_tags($catname), 0 , 1);

       if(strcasecmp($first_letter,$letter) != 0) continue;
       else {
        $cats[] = $category->term_id;
        $cats[] = $category->name;
     }
    }
    return $cats;

   }

error code: 523