Skip to content

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.

2 participants