Skip to content

Commit d35f84b

Browse files
authored
Merge pull request #26 from web3p/remove-leading-zero
Remove leading zero when encode string
2 parents 1653af2 + a7e81a2 commit d35f84b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Types/Str.php

+3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ static function encode(string $input, string $encoding='utf8')
3838
if (strpos($input, '0x') === 0) {
3939
$input = str_replace('0x', '', $input);
4040
}
41+
if (mb_strlen($input) > 2) {
42+
$input = ltrim($input, '0');
43+
}
4144
$output = $input;
4245

4346
break;

0 commit comments

Comments
 (0)