Brian Dunning's FileMaker Custom Functions

stringToList ( theString )

a simple recursive CF to convert a string of characters into a list.

  Average rating: 4.6 (25 votes) Log in to vote

Eduardo Lemos   Eduardo Lemos
n/a
http://donothaveone.com

Share on Facebook Share on Twitter

  Sample input:
"Lorem ipsum dolor sit amet,"
  Sample output:
"L¶o¶r¶e¶m¶¶i¶p¶s¶u¶m¶¶d¶o¶l¶o¶r¶¶s¶i¶t¶¶a¶m¶e¶t¶,"

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

since I could not find a custom function to do only this task, i decided to write one.
also, it may be modified to "explode" a sentence — for example:
"Lorem ipsum dolor sit amet." into
"L
Lo
Lor
Lore
Lorem
Lorem
Lorem i
Lorem ip
[ … ]
Lorem ipsum dolor sit amet."

for such, rewrite it as,

Case (
Length ( theString ) > 1 ;
stringToList ( Left ( theString ; Length ( theString ) - 1 ) ) & "¶" & theString;
theString
)

i also tested the CF with a 9956-character (17-paragraph) "Lorem ipsum;" even though it took over 15 seconds on a Mac Mini to have it fully "exploded," it did the job.
hope it helps;

cheers, all.

 

Comments

unix   unix, Japan
Jan 4, 2016
If you want speed, this takes about half time of yours.

Case (
Length ( theString ) < 2 ; theString ;
stringToList2 ( Left ( theString ; Ceiling ( Length ( theString ) / 2 ) ) ) & "¶" & stringToList2 ( Right ( theString ; Length ( theString ) / 2 ) )
)
 
Eduardo Lemos   Eduardo Lemos, Victoria, Canada /Sao Paulo, Brazil
Jan 8, 2016
hey, Unix,

thanks a lot — domo arigatô gozai masu!
a concise and quite clever approach; i shall try it.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: