Skip to content

feat: accept bare hex strings in ToUint64 - #353

Open
Solaris-star wants to merge 1 commit into
spf13:masterfrom
Solaris-star:feat/334-hex-string-to-uint64
Open

feat: accept bare hex strings in ToUint64#353
Solaris-star wants to merge 1 commit into
spf13:masterfrom
Solaris-star:feat/334-hex-string-to-uint64

Conversation

@Solaris-star

Copy link
Copy Markdown

Summary

strconv.ParseUint with base 0 only treats hex with a 0x/0X prefix. Bare hex like 882d5422d5fffff failed to cast (#334).

Fix

If base-0 parse fails and the string is hex digits with at least one a-f letter, retry base 16.

Tests

go test . -count=1 -run TestToUint64HexString
# ok

Fixes #334

strconv.ParseUint base 0 only treats hex with a 0x prefix. Accept bare
hex (with a-f letters) so values like "882d5422d5fffff" cast correctly
(spf13#334).

Fixes spf13#334
@CLAassistant

CLAassistant commented Jul 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Solaris-star

Copy link
Copy Markdown
Author

I have signed the CLA. Please recheck the current status.

@Solaris-star

Copy link
Copy Markdown
Author

recheck

3 similar comments
@Solaris-star

Copy link
Copy Markdown
Author

recheck

@Solaris-star

Copy link
Copy Markdown
Author

recheck

@Solaris-star

Copy link
Copy Markdown
Author

recheck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add hex string to uint64 conversion support

2 participants