diff options
author | Kurt Jung <kurt.w.jung@code.google.com> | 2013-08-23 11:50:17 -0400 |
---|---|---|
committer | Kurt Jung <kurt.w.jung@code.google.com> | 2013-08-23 11:50:17 -0400 |
commit | f3b514a3763d2f5127e2a36cfdb662c6eb4924ac (patch) | |
tree | 4c0ebb4d8dc944bde3a88c90401ef38e70ba360d /util.go | |
parent | c6a09fef08ef94067a714feea492e2f86fc41428 (diff) |
Added clipping support adapted from script by Andreas Würmser
Diffstat (limited to 'util.go')
-rw-r--r-- | util.go | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -202,3 +202,21 @@ func utf8toutf16(s string) string { } return string(res) } + +// Return a if cnd is true, otherwise b +func IntIf(cnd bool, a, b int) int { + if cnd { + return a + } else { + return b + } +} + +// Return aStr if cnd is true, otherwise bStr +func StrIf(cnd bool, aStr, bStr string) string { + if cnd { + return aStr + } else { + return bStr + } +} |