Skip to main content
100%

Recursive function to evaluate whether a phrase is a palindrome

✓ Published0🌍 Public
CCliffordAnderson
Last edited Mar 24, 2014
Created on Mar 24, 2014

This example demonstrates a recursive XQuery function that determines whether a phrase is a palindrome, using the Persian sentence "شکر بترازوی وزارت برکش" as test data. The function checks length, compares first and last characters, and recursively tests the trimmed remainder via XPath `fn:string-length`, `fn:substring`, and `fn:replace`. The initial phrase is normalized with `fn:lower-case` and whitespace removal before evaluation. The code relies solely on the standard XQuery 3.0 function library, with no external visualization or rendering dependencies.

AI-generated description

Similar vizzes