SOLVED

LAMDA to find last instance of a search string within another string

Iron Contributor

Can some one help covert the below to a lambda function using recursion

I am aware that this is possible using SUBSTITUTE - I was just wondering how to get LAMDBA to exit on Error when it is used recursively

 

Cheers Sam

Picture1.png

4 Replies
best response confirmed by allyreckerman (Microsoft)
Solution

@Sameer_Bhide   Please see attached, or transcribe from below snapshot.

 

tboulden_1-1627840701816.png

 

 

@tboulden 

Oh Wow !!!  Thanks - I was struggling with this problem for quite some time and your solution is going to take most part of today for me to figure out.


Also a great way of showing now the new Lambda helper functions (SCAN in this case) leads to a more elegant solution


Thanks once again for your effort.

Cheers
Sam

@Sameer_Bhide  It occurred to me later that the new ISOMITTED function could make this inner-loop structure unnecessary; had used it so that outer function only needed two parameters and the inner function's array argument wasn't needed to be a blank parameter.

 

tboulden_0-1627926273746.png

 

@tboulden 

 

I also realized that the same output can be achieved without iteration as below

FINDALL

=LAMBDA(txt,dl,
LET(
vPos,SEQUENCE(LEN(txt)),
vChars,MID(txt,vPos,1),
result,FILTER(vPos,vChars=dl),
result))

1 best response

Accepted Solutions
best response confirmed by allyreckerman (Microsoft)
Solution

@Sameer_Bhide   Please see attached, or transcribe from below snapshot.

 

tboulden_1-1627840701816.png

 

 

View solution in original post