Skip to content

Commit

Permalink
adding util common function
Browse files Browse the repository at this point in the history
  • Loading branch information
pratikmota committed May 12, 2024
1 parent 36081df commit 990288e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,15 @@ func TruncateString(s string, maxLen int) string {
return string(runes[0:maxLen-3]) + "..."
}

// GetDimValue get max x-y or 0 value
func GetDimValue(x, y float64) float64 {
difference := x - y
if difference > 0 {
return difference
}
return 0
}

/*
func RemoveDuplicate[T comparable](sliceList []T) []T {
allKeys := make(map[T]bool)
Expand Down

0 comments on commit 990288e

Please sign in to comment.