# Backwards ( _Field )

return a string backwards (mirror writing)

Average rating: 4.4 (31 votes) Log in to vote

Alexander Baier FM Tutorial http://www.fm-tutorial.de |

Sample input:

Backwards ( "Hello" )

Backwards ( "12345" )

Backwards ( "12345" )

Sample output:

olleH

54321

54321

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

This recursive function returns any string backwards.

## Comments

Bart, Vero Beach May 23, 2013 |
||

I guess this CF begs the question, "why?" Just curious. :-) |
||

Alexander Baier, Germany May 23, 2013 |
||

- Calculations of checksums - mathematical operations or mathematical curiosities e.g ( 731 - 137 = 594 + 495 = 1089 this algorithm is valid for three-digit numbers (n>m>p)) or simply for mischief :-) |
||

Daniele Raybaudi, ACI May 27, 2013 |
||

concise mode: If ( Length ( _Field ) ; Backwards ( Right ( _Field ; Length ( _Field ) - 1 ) ) ) & Left ( _Field ; 1 ) |
||

Vinny, Somerset, NJ USA May 31, 2013 |
||

Don't you mean "feihcsim"? :) | ||

John Segers Jun 10, 2015 |
||

Beautiful function very usefull to me. I am not at all stupid, but I could never make this one myself. Can somone please explain to me why it's working? THX a lot |
||

Justin, Salem, Oregon Jun 17, 2015 |
||

Just found this function and it was exactly what I was looking for. As far as 'why'? It worked wonders for my need to reverse a string of characters so that I could feed that into the Code() function (which reverses the characters itself in its output). I needed those code points to be in the proper word order, not the reversed Code() output order. It works by passing in an ever diminishing right-hand list of characters to itself, and then returns the left hand side of things once it reaches the end. So say we called Backwards ("abc"). 1) Backwards ("abc") => _field = "abc" 1A) Length > 0, so call Backwards ("bc") & "a" 2) Backwards ("bc") => _field = "bc" 2A) Length > 0, so call Backwards ("c") & "b" 3) Backwards ("c") => _field = "c" 3A) Length > 0, so call Backwards ("") & "c" 4) Backwards ("") => _field = "" 4A) Length NOT >0, so return Left("") (which is empty) 4A returns ("") to 3A => "" & "c" = "c" ...which returns "c" to 2A => "c" & "b" = "cb" ...which returns "cb" to 1A => "cb" & "a" = "cba" I think the calculation could be modified a bit, but haven't tested anything. It works as it is. It isn't Tail recursion, so you wouldn't want to pass strings longer than 10,000 characters to it. |
||

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