summaryrefslogtreecommitdiff
path: root/replacer.go
diff options
context:
space:
mode:
Diffstat (limited to 'replacer.go')
-rw-r--r--replacer.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/replacer.go b/replacer.go
index 86cd729..29d8e26 100644
--- a/replacer.go
+++ b/replacer.go
@@ -66,6 +66,13 @@ func (r *Replacer) Get(variable string) (interface{}, bool) {
return nil, false
}
+// GetString is the same as Get, but coerces the value to a
+// string representation.
+func (r *Replacer) GetString(variable string) (string, bool) {
+ s, found := r.Get(variable)
+ return toString(s), found
+}
+
// Delete removes a variable with a static value
// that was created using Set.
func (r *Replacer) Delete(variable string) {