summaryrefslogtreecommitdiff
path: root/util.go
diff options
context:
space:
mode:
authorKurt Jung <kurt.w.jung@code.google.com>2013-08-23 11:50:17 -0400
committerKurt Jung <kurt.w.jung@code.google.com>2013-08-23 11:50:17 -0400
commitf3b514a3763d2f5127e2a36cfdb662c6eb4924ac (patch)
tree4c0ebb4d8dc944bde3a88c90401ef38e70ba360d /util.go
parentc6a09fef08ef94067a714feea492e2f86fc41428 (diff)
Added clipping support adapted from script by Andreas Würmser
Diffstat (limited to 'util.go')
-rw-r--r--util.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/util.go b/util.go
index 5043601..b2202ca 100644
--- a/util.go
+++ b/util.go
@@ -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
+ }
+}