Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Semrush - keyword research tool

Linux Foundation Training and Certification

Teach Your Child To Read

Disclosure: My content contains affiliate links.

32,310 questions

42,485 answers

573 users

How to check whether a string is palindrome or not in Dart

1 Answer

0 votes
void main() {
    var string = "rotator";
    var palindrome = true;
    
    for (var i = 0; i < string.length / 2; i++) {
        if (string[i] != string[string.length - i - 1]) {
            palindrome = false;
            break;
        }
    }
    
    if (palindrome) {
        print("Palindrome");
    }
    else {
        print("Not Palindrome");
    }
}



  
/*
run:
   
Palindrome
   
*/

 



Learn & Practice Python
with the most comprehensive set of 13 hands-on online Python courses
Start now


answered Jun 3, 2023 by avibootz

Related questions

1 answer 55 views
1 answer 62 views
62 views asked Oct 11, 2022 by avibootz
1 answer 46 views
1 answer 56 views
1 answer 57 views
...