Changeset 474


Ignore:
Timestamp:
Apr 5, 2014 8:10:53 PM (10 years ago)
Author:
anonymous
Message:

Added nonexistant mb_str_pad function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Utilities.inc.php

    r469 r474  
    365365    {
    366366        return str_replace(mb_split('.', $from), mb_split('.', $to), $string);
     367    }
     368}
     369
     370/*
     371* A substitution for the missing mb_str_pad function.
     372*
     373* @access   public
     374* @param    string  $input      The string that receives padding.
     375* @param    string  $pad_length Total length of resultant string.
     376* @param    string  $pad_string The string to use for padding
     377* @param    string  $pad_type   Flags STR_PAD_RIGHT or STR_PAD_LEFT or STR_PAD_BOTH
     378* @return   string          String with translated characters.
     379* @author   Quinn Comendant <quinn@strangecode.com>
     380* @version  1.0
     381* @since    20 Jan 2013 12:33:26
     382*/
     383if (!function_exists('mb_str_pad')) {
     384    function mb_str_pad($input, $pad_length, $pad_string=' ', $pad_type=STR_PAD_RIGHT) {
     385        $diff = strlen($input) - mb_strlen($input);
     386        return str_pad($input, $pad_length + $diff, $pad_string, $pad_type);
    367387    }
    368388}
     
    11231143    }
    11241144}
     1145
Note: See TracChangeset for help on using the changeset viewer.