<cffunction
name="ApplyTextMap"
access="public"
returntype="string"
output="false"
hint="Applies the given map (name-value structure) to the given text value.">
<cfargument
name="Text"
type="string"
required="true"
hint="The text to which we will be applying the text map."
/>
<cfargument
name="Map"
type="struct"
required="true"
hint="The struct containing the key-value text mappings."
/>
<cfset var LOCAL = StructNew() />
<cfset LOCAL.Text = ARGUMENTS.Text />
<cfloop
item="LOCAL.Key"
collection="#ARGUMENTS.Map#">
<cfset LOCAL.Text = ReplaceNoCase(
LOCAL.Text,
LOCAL.Key,
ARGUMENTS.Map[ LOCAL.Key ],
"ALL"
) />
</cfloop>
<cfreturn LOCAL.Text />
</cffunction>