<concat>

Purpose/Function

Concatenates strings into a single string. The <substring> can be an arbitrary object (toString() is implicitly called on it).

This task exists only for the sake of explicitness. The same operation can be achieved more simply (see the second example below) using the built-in expression mechanism.

Attributes

None.

Elements

TAG

TYPE

COUNT

DESCRIPTION

<substring>

java.lang.Object

0:N

part to be concatenated; these should be added in order

ReturnValues

DEFAULT NAME

TYPE

DESCRIPTION

newString

java.lang.String

the concatenated string

Examples

<ogrescript>
        <declare name="object" string="frag1"/>
	<declare name="frag0" string=".toString() = "/>
	<declare name="frag1">
		<new-object/>
	</declare>
	<concat>
	        <substring>RESULT:  </substring>
		<substring>${object}</substring>
		<substring>${frag0}</substring>
		<substring>${frag1}</substring>
		<return-value assignedName="frag0" defaultName="newString"/>
	</concat>
	<echo message="${frag0}"/>
</ogrescript>

The above example is equivalent to doing:

<ogrescript>
        <declare name="object" string="frag1"/>
	<declare name="frag0" string=".toString() = "/>
	<declare name="frag1">
		<new-object/>
	</declare>
        <assign name="frag0" string="RESULT:  ${object}${frag0}${frag1}"/>
	<echo message="${frag0}"/>
</ogrescript>
  • No labels