Palindrome check

Size
2,177 Kb
Views
34,408

How do I make an palindrome check?

What is a palindrome check? How do you make a palindrome check? This script and codes were developed by Tom Lutzenberger on 24 August 2022, Wednesday.

Palindrome check Previews

Palindrome check - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Palindrome check</title> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'>
</head>
<body> <div class="container"><div class="row"> <div class="col-sm-12"> <h1>Palindrome check</h1> <table class="table table-striped"> <thead> <tr> <th>string</th> <th>palindrome?</th> </tr> </thead> <tbody> <tr><td class="string">123 456 789 09 87 65 43 21</td><td><span class="glyphicon"></span></td></tr> <tr><td class="string">012 34 3 21</td><td><span class="glyphicon"></span></td></tr> <tr><td class="string">put it up</td><td><span class="glyphicon"></span></td></tr> <tr><td class="string">stack cats</td><td><span class="glyphicon"></span></td></tr> <tr><td class="string">No ‘x’ in Nixon</td><td><span class="glyphicon"></span></td></tr> <tr><td class="string">step on no pets</td><td><span class="glyphicon"></span></td></tr> <tr><td class="string">Was it a car or a cat I saw?</td><td><span class="glyphicon"></span></td></tr> <tr><td class="string">A man, a plan, a canal - Panama!</td><td><span class="glyphicon"></span></td></tr> <tr><td class="string">Doc, note: I dissent. A fast never prevents a fatness. I diet on cod.</td><td><span class="glyphicon"></span></td></tr> <tr><td class="string">This is not a palindrome. That's the reason there's a red "x" instead of a green checkmark.</td><td><span class="glyphicon"></span></td></tr> <tr><td class="string">T. Eliot, top bard, notes putrid tang emanating, is sad; I'd assign it a name: gnat dirt upset on drab pot toilet.</td><td><span class="glyphicon"></span></td></tr> </tbody> </table> </div>
</div> <script src='https://code.jquery.com/jquery-2.2.4.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Palindrome check - Script Codes JS Codes

$(document).ready(function() { $("tbody tr").each(function() { var classes = isPalindrome($(this).children("td.string").text()) ? "glyphicon-ok text-success" : "glyphicon-remove text-danger"; $(this).find("td .glyphicon").addClass(classes); });
});
function isPalindrome(str) { str = str.toLowerCase().replace(/[^a-z0-9]*/g, ""); var halfLen = Math.floor(str.length / 2); var strHalf = str.substring(0, halfLen); var strHalfRev = str.substring(str.length-halfLen, str.length); return reverse(strHalfRev) == strHalf;
}
function reverse(s) { return s.split('').reverse().join('');
}
Palindrome check - Script Codes
Palindrome check - Script Codes
Home Page Home
Developer Tom Lutzenberger
Username tomlutzenberger
Uploaded August 24, 2022
Rating 3
Size 2,177 Kb
Views 34,408
Do you need developer help for Palindrome check?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Tom Lutzenberger (tomlutzenberger) Script Codes
Create amazing SEO content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!