Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Palindrome

Community Beginner ,
Jun 28, 2021 Jun 28, 2021

Copy link to clipboard

Copied

Hi, I have field "Text1" I want to check if string from that field contains palindrome and write "Yes" or "No" in another field.
Is that possible?

TOPICS
How to

Views

319

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Jun 28, 2021 Jun 28, 2021
You can use this as calculation script of yes/no field: var str = this.getField("Text1").valueAsString; var pal = str.replace(/[^\w]/g, ""); var x = pal.split('').reverse().join(''); if(str == "") event.value = ""; else if(x === pal) event.value = "Yes"; else event.value = "No";

Likes

Translate

Translate
Adobe Community Professional ,
Jun 28, 2021 Jun 28, 2021

Copy link to clipboard

Copied

Hi, I am not sure that can be done without checking against a list stored in the language you want, especially if all the letters of the word are entered in the same field instead of 1 letter per field.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 28, 2021 Jun 28, 2021

Copy link to clipboard

Copied

You can use this as calculation script of yes/no field:

var str = this.getField("Text1").valueAsString;
var pal = str.replace(/[^\w]/g, "");
var x = pal.split('').reverse().join('');
if(str == "") event.value = "";
else if(x === pal) event.value = "Yes";
else event.value = "No";

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 28, 2021 Jun 28, 2021

Copy link to clipboard

Copied

How does you check the sense of the words?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 28, 2021 Jun 28, 2021

Copy link to clipboard

Copied

You can only check a subset of possible  words.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 28, 2021 Jun 28, 2021

Copy link to clipboard

Copied

LATEST

UPDATE: I made a mistake in my post, I meant to check if string is palindrome not if it contains one.

Thanks Nesa for your script Il try it later and get back to you.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines