Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string float act like float when converted to int* #210

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yveshield
Copy link
Contributor

#204 #172

built in:
cast.ToInt64E(float64(8.2)) => 8

previously:
cast.ToInt64E(string("8.2")) => unable to cast "8.2" of type string to int64

more expected:
cast.ToInt64E(string("8.2")) => 8

If you agree with my thoughts or have a better understanding, feel free to leave a comment for discussion.

	modified:   cast_test.go
	modified:   caste.go
@@ -1496,3 +1496,29 @@ func trimZeroDecimal(s string) string {
}
return s
}

func truncateDecimals(s string) string {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this function could use a test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I have added it.

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.

None yet

2 participants