Combine ( decimal ; ObjList )
Get a substring under mask
Average rating: 4.2 (24 votes) Log in to vote
Erich Schmidt - Show more from this author |
Combine(2^3+2^2;"76543210")
32
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
The function returns a substring of "ObjList". The binary form of "decimal" is considered as a mask that overlies the string "ObjList".
A character of "Obj List" is selected, if the coresponding character in the mask is 1.
The function call
CustomList ( 1 ; 2^4-1 ; "Combine ( [n] ; \"ABCD\" ) " ) returns a list with all subsets of "ABCD":
D
C
CD
B
BD
BC
BCD
A
AD
AC
ACD
AB
ABD
ABC
ABCD
For TEXT="TELEPHONE" returns
Let ( [ $N= Length ( TEXT ) ]; CustomList ( 1 ; $N ; "Combine ( 2^$N - 2^($N-[n]) ; TEXT )" ) ) ;
the list
T
TE
TEL
TELE
TELEP
TELEPH
TELEPHO
TELEPHON
TELEPHONE
For TEXT="AaBbCcDdEeFfGg" with
Let( [ $MyList= CustomList ( 1 ; Div ( Length ( TEXT ) ; 2 ) ; "2^(2*[n]-1)" ); S= Evaluate ( Substitute ( $MyList ; ΒΆ ; "+" ) ) ]; Combine ( S ; TEXT ));
you get "ABCDEFG"
Comments
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.