last one... sorry.
change the order of the output of the sentences array. Like this.
Robert.
<!--- Output the sentences --->
<cfloop to="1" from="#arrayLen(sentences)#" step="-1" index="i">
<cfoutput>#sentences[i]#</cfoutput>
</cfloop>
then that should yield.
"I hate dogs. They leave out hair and barks."
-----Original Message-----
From: Hinojosa, Robert A [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 30, 2001 5:05 PM
To: CF-Talk
Subject: RE: Put into Reverse
I might've misunderstood your first request because I thought that the
periods at the end of the reverse request was a typo. But I think I
understand now, only the words are reversed and not sentence
structure(periods)? Anyway, if they are, here is that code that will keep
that in tact.
Robert
<cfset str = "skrab dna riah tuo evael yehT. sgod etah I.">
<cfset sentences = arrayNew(1)>
<cfset counter = 1>
<!--- Loop through Sentences --->
<cfloop list="#str#" index="sentence" delimiters=".">
<cfset newStr = "">
<!--- Reverse Sentence --->
<cfloop to="1" from="#Len(sentence)#" step="-1" index="i">
<cfset newStr = newStr & mid(sentence, i, 1)>
</cfloop>
<!--- Add the delimiter back --->
<cfset newStr = trim(newStr) & ".">
<!--- Add sentence to array --->
<cfset sentences[counter] = newStr>
<cfset counter = counter + 1 >
</cfloop>
<!--- Output the sentences --->
<cfloop from="1" to="#arrayLen(sentences)#" index="i">
<cfoutput>#sentences[i]#</cfoutput>
</cfloop>
-----Original Message-----
From: Michael Lugassy [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 30, 2001 5:25 PM
To: CF-Talk
Subject: Put into Reverse
I'm having difficulties reversing a long string that was written in backward
hebrew.
which means it was first written from right to left AND opposite (dont
ask...)
something like:
skrab dna riah tuo evael yehT. sgod etah I.
I want to get this string back to it's straight form
("I hate dogs. They leave out hair and barks.").
Reversing all the string won't help, neither will reversing each word and
sticking it together (sentences won't be in order). I had limited success
when
trying to first split the sentences ("." as the delimter), but no 100%
solution.
I know this is doable, because Internet Explorer uses the Visual Encoding,
which
acts the same (on the same text).
! pleH
leahciM
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists