Skip to content

Commit

Permalink
Merge pull request #26 from web3p/remove-leading-zero
Browse files Browse the repository at this point in the history
Remove leading zero when encode string
  • Loading branch information
sc0Vu authored Apr 27, 2022
2 parents 1653af2 + a7e81a2 commit d35f84b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Types/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ static function encode(string $input, string $encoding='utf8')
if (strpos($input, '0x') === 0) {
$input = str_replace('0x', '', $input);
}
if (mb_strlen($input) > 2) {
$input = ltrim($input, '0');
}
$output = $input;

break;
Expand Down

0 comments on commit d35f84b

Please sign in to comment.