Jump to content
Server Maintenance This Week. ×

Just need a little help understanding this CF


This topic is 4714 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi, all:

I'm having a bit of a brain hernia trying to understand how the following, recursive CF--that creates an acronym of an organization's name--works:

-------------

Let ( [

numWords = WordCount (TextString) ;

firstLetter = Upper (Left (TextString ; 1))

];

Case ( numWords > 0 ; firstLetter & Acronym_CFpub ( RightWords (TextString ; numWords - 1)))

)

-------------

I "get" the Let part of the CF and the first part/left side of the Case statement, but it's the recursive part (right side) of the Case statement that's throwing me for a loop. (Okay, that was a lame pun.)

Say the organization's name is Froot Loop Jihad:

When there's more than one word (numWord) does the CF work from "right to left" where, on the first pass, FMP looks at the right side of the calc and says, "Oh, for the TextString ("Froot Loop Jihad") there are three words so I'll take away the right-most one and..." But if it does that, how does it grab its first letter?

...and that's where I get confused. (It's no wonder I failed Geometry because I couldn't figure out how to "proof" shapes.) Any help in 'splainin' the theory here would be great appreciated.

Link to comment
Share on other sites

It works from left to right. It takes the first character of TextString, then calls the function again with TextString minus the first word.

See also:

http://fmforums.com/forum/topic/59216-proper-text/page__view__findpost__p__280075

Link to comment
Share on other sites

This topic is 4714 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.