Skip to content

Commit

Permalink
add new method
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonid74 committed Mar 18, 2022
1 parent d470242 commit 9b8db5b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/StringHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,4 +407,22 @@ public static function isBase64Encoded( ?string $sString = '', ?array $enc = ['U

return true;
}

/**
* Return transliterated string (with á é ò etc.) to string contain proper LATIN characters only
*
* @param string $sString
*
* @return string
*
* @author Leonid Sheikman <[email protected]>
*/
public static function toLatinString( ?string $sString = '' ): string
{
if ( '' === $sString || \is_null( $sString ) ) {
return '';
}

return transliterator_transliterate( 'Any-Latin; Latin-ASCII; [\u0180-\u7fff] remove', $sString );
}
}

0 comments on commit 9b8db5b

Please sign in to comment.