Newbies CarlP Posted January 30, 2006 Newbies Posted January 30, 2006 Can someone with more experience of custom functions help on this please? A field within a table is basically an html page containing the usual html code. A sample layout is below: %C+%the dog jumped over the moon%C-% Other page content and html code here %C+%then another dog tried as well%C-% The "%C+%" and "%C-%" tags denote the beginning and end of capitalisation (or use of FM's Proper function) and trying unsucessfully so far to create a function which act on all "starting tags" and find the "ending tag" and Capitalise all content between, then remove the start and end tag. Any clues or suggestions would be much appreciated Thanks!
comment Posted January 30, 2006 Posted January 30, 2006 Basically, you need something like this: 1. Put the entire text inside quotes 2. Substitute each "%C+%" with: "" & Proper ( " " 2. Substitute each "%C-%" with: "" ) & "" 3. Evaluate the result. I wrote this without testing and I may have a syntax error (it IS a bit tricky), but the principle should work.
Newbies CarlP Posted January 30, 2006 Author Newbies Posted January 30, 2006 That was quick veteran -) I was just checking out a similar same concept as in Bob Weaver's post using the substitute function here: http://www.fmforums.com/forum/showtopic.php?tid/149507/ where all field content is changed. Many thanks for this - I'll try playing with it now!
Newbies CarlP Posted February 2, 2006 Author Newbies Posted February 2, 2006 OK... Been playing with this for too long now with little result tho have no problems replicating it in a programable editor and seems a fairly basic routine. There *may* be a simpler way in FM but goes like this: (a) get to the field start (: search for %C+% (if not found - abort) and mark/grab the start position © continue until %C-% found (d) grab all content between %C+% and %C-% (inclusive) and Proper (capitalize) this (e) Substitute %C+% and %C-% with "" (f) Go back to field start and repeat until no further %C+%'s are found within the field. Any clues from folks with more FM custom function experience than I've got?
comment Posted February 2, 2006 Posted February 2, 2006 As I said, recursion is not really required here. I don't know why you had no results. This seems to do what you want: Evaluate ( Substitute ( Quote ( text ) ; [ "%C+%" ; "" & Proper ( "" ] ; [ "%C-%" ; "") & "" ] ) )
Newbies CarlP Posted February 2, 2006 Author Newbies Posted February 2, 2006 Could life be easier Comment? : Thank you so much for you help - it's much appreciated! This works perfectly! :thumbup:
Recommended Posts
This topic is 7204 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 accountSign in
Already have an account? Sign in here.
Sign In Now