• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

551

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

Community Expert , 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";

Votes

Translate

Translate
Community Expert ,
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.

Votes

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 Expert ,
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";

Votes

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 Expert ,
Jun 28, 2021 Jun 28, 2021

Copy link to clipboard

Copied

How does you check the sense of the words?

Votes

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 Expert ,
Jun 28, 2021 Jun 28, 2021

Copy link to clipboard

Copied

You can only check a subset of possible  words.

Votes

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.

Votes

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