Skip to content

Bio Expression String Interpolation

Rajab Davudov edited this page Jun 20, 2019 · 4 revisions

String Interpolation

String interpolation is also supported by ${ }$ tokens. Also parsing is a little bit different.

BioExpression expr = BioExpression.parseFormatted("My name is ${student.name}$. I am ${student.age}$ years old.") ;

When we call it using a student Bio Object we get following result.

Student s = new Student() ;
s.set(Student.NAME, "Danial") ;
s.set(Student.AGE, 18) ;

String interpolated = (String) expr.getValue(s) ;
System.out.println(interpolated) ;
My name is Daniel. I am 18 years old.