I will periodically post coding challenges to be solved with LiveCode.
Solving problems is a great way to improve your coding skills.
Vote for the best answer.
please paste plain text only.
please add [code] at the beginning of your code, and [/code] at the end to facilitate syntax colorizing.
if you see that ‘AndyP edited….’ your answer, this will be only for formatting.. I will not be changing your answer.
Provide a method that will check if a word, digits or a series of words constitutes a palindrome.
The result of the test should be either true or false.
A palindrome is a word, phrase, number, or other sequence of symbols or elements, whose meaning may be interpreted the same way in either forward or reverse direction.
List of palindromes to check with your solution.
A Santa at Nasa
Some men interpret nine memos
Never odd or even
This is my solution to the problem…
put “A Santa at Nasa” & CR into tElenco
put “racecar” & CR after tElenco
put “Some men interpret nine memos” & CR after tElenco
put “This is not palindrome” & CR after tElenco
put “5885” & CR after tElenco
put “Never odd or even” & CR after tElenco
put “Etna gigante” after tElenco
put empty into tRisultato
repeat for each line tLinea in tElenco
put tLinea into tOldLinea
replace space with empty in tLinea //Erase all spaces
put toLower(tLinea) into tLinea //All chars to lowercase
put len(tLinea) into tConta //Len of string
if tConta mod 2 = 0 then
put (tConta/2) into tLen
put ((tConta-1)/2) into tLen
repeat with tN = 1 to tLen
if chartonum(the char tN in tLinea) <> chartonum(the char ((tConta + 1) – tN) in tLinea) then
if tN = tLen then put tOldLinea & cr after tRisultato
answer tRisultato as sheet