coldfusion for remove a string and save as new string
I have a big string that I want to remove a part of it and save it as a new string? I've tried replace, find ect...and I dont think there is a function that allow me to do that. any ideas?
thanks
I have a big string that I want to remove a part of it and save it as a new string? I've tried replace, find ect...and I dont think there is a function that allow me to do that. any ideas?
thanks
can you clarify a little bit more? thanks.
Add any lines not matching the To and From lines to a new variable.
<cfset newText="" />
<cfloop list="#email_list.body#" delimiters="#chr(13)##chr(10)#" index="line">
//* replace the whole from line with empty *//
<cfif REFindNoCase("From:.*",line)>
<cfset from_line = line />
<cfset from_line = #REReplaceNoCase("#from_line#", "From:.*", "")# />
//* replace the whole To line with empty *//
<celsefif REFindNoCase("To:.*",line)>
<cfset to_line = line />
<cfset to_line = #REReplaceNoCase("#to_line#", "To:.*", "")# />
<cfelse>
<!--- if not removing line add to newText string --->
<cfset newText=newText & line & chr(13) & chr(10) />
</cfif>
</cfloop>
<cfoutput>#newText#</cfoutput> <!--- email text without to and from lines --->
This was truncated when I posted it previously.
Already have an account? Login
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.