code: public static String replaceFunctionsInString(final String stringValue, TestContext context, boolean enableQuoting) {
          // make sure given string expression meets requirements for having a function
          if (!StringUtils.hasText(stringValue) ||
                  (stringValue.indexOf(':') < 0) || (stringValue.indexOf('(') < 0) || (stringValue.indexOf(')') < 0) ) {
  
              // it is not a function, as it is defined as 'prefix:methodName(arguments)'
              return stringValue;
          }
          
          String newString = stringValue;
          StringBuffer strBuffer = new StringBuffer();
  
          boolean isVarComplete = false;
          StringBuffer variableNameBuf = new StringBuffer();
  
          int startIndex = 0;
          int curIndex;
          int searchIndex;
  
          for (FunctionLibrary library: context.getFunctionRegistry().getFunctionLibraries()) {
              startIndex = 0;
  
              while ((searchIndex = newString.indexOf(library.getPrefix(), startIndex)) != -1) {
                  int control = -1;
                  isVarComplete = false;
  
                  curIndex = searchIndex;
  
                  while (curIndex < newString.length() && !isVarComplete) {
                      if (newString.indexOf('(', curIndex) == curIndex) {
                          control++;
                      }
  
                      if (newString.charAt(curIndex) == ')' || curIndex == newString.length() - 1) {
                          if (control == 0) {
                              isVarComplete = true;
                          } else {
                              control--;
                          }
                      }
  
                      variableNameBuf.append(newString.charAt(curIndex));
                      curIndex++;
                  }
  
                  final String value = resolveFunction(variableNameBuf.toString(), context);
  
                  strBuffer.append(newString.substring(startIndex, searchIndex));
  
                  if (enableQuoting) {
                      strBuffer.append("'" + value + "'");
                  } else {
                      strBuffer.append(value);
                  }
  
                  startIndex = curIndex;
  
                  variableNameBuf = new StringBuffer();
                  isVarComplete = false;
              }
  
              strBuffer.append(newString.substring(startIndex));
              newString = strBuffer.toString();
  
              strBuffer = new StringBuffer();
          }
  
          return newString;
      }
docs: Search for functions in string and replace with respective function result.
  @param stringValue to parse.
  @param enableQuoting enables quoting of function results.
  @return parsed string result.