REMOVING PART OF A STRING

I have a string that resides in a table called itemresponse, and the field name is youranswer.  In the youranswer field I have a string that looks like
response~A^correct~1^confirmed~0 or response~B^Correct~0  Is there a way to use Cold Fusion to update youranswer field and get rid of everything after Correct~0 so that the strings that are response~B^correct~0^confirmed~1 turn into response~A^correct~1?  The are about 500K answers in this field and like I said, some are already the shorter version while most of them are the long string.

Any help would be appreciated
Thanks
Nick
LVL 2
nmaranoAsked:
Who is Participating?
 
pcaiooConnect With a Mentor Commented:
I think think helps you better

<cfset youranswer = replace(youranswer,"^confirmed~0","">
<cfset youranswer = replace(youranswer,"^confirmed~1","">

so ^confirmed~1 and ^confirmed~0 will both be removed


0
 
pinaldaveConnect With a Mentor Commented:
Hi nmarano,
 
left('response~A^correct~1^confirmed~0',find("Correct~0","response~A^correct~1^confirmed~0"))

would do it for you.

Regards,
---Pinal
0
 
nmaranoAuthor Commented:
Thanks for the help
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
pcaiooCommented:
are you accepting my answer or his ??? as i got good assist email ??? confused
0
 
nmaranoAuthor Commented:
I accepted yours, but split the points 200 to him, 300 to you with a grade of A
0
 
pcaiooCommented:
O sorry as I never ask question so not quite know how it work...
is it means both of us will receive a Assisted Answer email ??
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.