mirror of https://github.com/vitalif/openscad
string indexing
parent
2cfcdf557d
commit
dcf4b83306
|
@ -85,6 +85,11 @@ Value Expression::evaluate(const Context *context) const
|
||||||
if (i >= 0 && i < int(v1.vec.size()))
|
if (i >= 0 && i < int(v1.vec.size()))
|
||||||
return *v1.vec[i];
|
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();
|
return Value();
|
||||||
}
|
}
|
||||||
if (this->type == "I")
|
if (this->type == "I")
|
||||||
|
|
Loading…
Reference in New Issue