Home > Contents > Index >
Expanded TOC | Accordion TOC | Annotated TOC | Index
ICS.ResolveVariables
Resolves any variable, built-in function, query column value, counter, or property embedded in an input string.
This method has the following two variants, both of which :
- ResolveVariables (Variant 1) : Uses the old replacement syntax.
- ResolveVariables (Variant 2) : Uses the new replacement syntax.
ICS.ResolveVariables
Resolves any variable, built-in function, query column value, counter, or property embedded in this string using the old replacement syntax.
Syntax
public String ResolveVariables(String str)Parameters
str- The string that may have embedded variables.
Description
The
ResolveVariablesmethod resolves any variable, built-in function, query column value, counter, or property embedded in an input string. For example, if passed the following input string:
"This is the year: CS.Year"the method returns the following string:
"This is the year: 2002"The "old" replacement syntax causes occasional ambiguities. We recommend using Variant 2 instead, which uses the "new" replacement syntax.
Returns
A
Stringin which the embedded variables are all resolved.Example
The following
Greetingstring contains two embedded variables:
String Greeting = "Hello, Variables.username. It is cs.Date."; String sg = ics.ResolveVariables(Greeting);At runtime,
sglooks similar to the following:
"Hello, Tom. It is Mon Mar 06 09:10:07 EST 2002."
ICS.ResolveVariables
Resolves any variable, built-in function, query column value, counter, or property embedded in this string using the new replacement syntax.
Syntax
public String ResolveVariables(String str, Boolean new)Parameters
str- The string that may have embedded variables.
new- Setting to
truetellsResolveVariablesto use the new replacement syntax. Setting tofalsetellsResolveVariablesto use the old replacement syntax, as described in ResolveVariables (Variant 1) .
Description
This variant of
ResolveVariablesuses the new replacement syntax. We recommend using the new syntax rather than the old. This new syntax lets you specify parentheses to clarify the order of evaluation; thus, the syntax is as follows:
$(Variable)For example, if passed the following input string:
"This is the year: $(CS.Year)"the method returns the following string:
"This is the year: 2002"For simple evaluations, as in the preceding example, the new syntax is not much different from the old syntax. However, for complex evaluations, the new syntax is much clearer. For example, consider the following ambiguous expression that uses the old syntax:
"Variables.listname.Variables.columnname"The preceding expression does not clarify which part of the expression should be evaluated first. Fortunately, the new syntax permits nesting. For example, the following
strtellsResolveVariablesto evaluate the expression in stages:
"$($(Variables.listname).$(Variables.columnname))"The order of evaluation in the preceding expression is as follows:
1. Evaluate
Variables.listname, yieldingL
2. Evaluate
Variables.columnname, yieldingC
3. Evaluate
L.CReturns
String with embedded variables resolved.
Error Numbers
Use
to view the error. Possible values ofGetErrnoerrnoinclude:
Value Description-106 You setnewtotrueand specified invalid variable references instr.
Home > Contents > Index > ![]()
Oracle JAVA Reference
Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.