summaryrefslogtreecommitdiff
path: root/src/expr.cc
diff options
context:
space:
mode:
authorBrad Pitcher <bradpitcher@gmail.com>2011-11-13 06:58:15 (GMT)
committerBrad Pitcher <bradpitcher@gmail.com>2011-11-13 06:58:15 (GMT)
commitdcf4b83306d0ebf50a43aedba4f2be1c169a7152 (patch)
treec557c6c37b048e2e0b8c3637c3a28cd649cd5ff7 /src/expr.cc
parent2cfcdf557d7742422965035a64ef617ac043a429 (diff)
string indexing
Diffstat (limited to 'src/expr.cc')
-rw-r--r--src/expr.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/expr.cc b/src/expr.cc
index fc1fbf0..7e1a25b 100644
--- a/src/expr.cc
+++ b/src/expr.cc
@@ -85,6 +85,11 @@ Value Expression::evaluate(const Context *context) const
if (i >= 0 && i < int(v1.vec.size()))
return *v1.vec[i];
}
+ if (v1.type == Value::STRING && v2.type == Value::NUMBER) {
+ int i = (int)(v2.num);
+ if (i >= 0 && i < v1.text.size())
+ return Value(v1.text.substr(i, 1));
+ }
return Value();
}
if (this->type == "I")
contact: Jan Huwald // Impressum