JpnForPhp\Helper\Helper::charAt PHP Method

charAt() public static method

Returns the character at the specified index.
See also: subString()
public static charAt ( string $str, integer $index ) : string
$str string The input string.
$index integer The index of the character to return (0 based indexing).
return string The character at the specified index.
    public static function charAt($str, $index)
    {
        return self::subString($str, $index, 1);
    }

Usage Example

コード例 #1
0
ファイル: HelperTest.php プロジェクト: mbilbille/jpnforphp
 public function testGetCharAtEndOfString()
 {
     $result = Helper::charAt($this->mixCharacters, -2);
     $this->assertEquals('す', $result);
 }