Palindrome check
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 - 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('');
}
Developer | Tom Lutzenberger |
Username | tomlutzenberger |
Uploaded | August 24, 2022 |
Rating | 3 |
Size | 2,177 Kb |
Views | 34,408 |
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!
Name | Size |
Auto-scaling iframes | 3,057 Kb |
Square-Box Vertical Center - Method 2 | 2,701 Kb |
Weather widget | 2,486 Kb |
Hxgn | 4,203 Kb |
Pseudo ASCII-Art | 10,362 Kb |
Standard Template | 1,454 Kb |
Square-Box Vertical Center | 2,774 Kb |
A Pen by Tom Lutzenberger | 2,530 Kb |
CSS Folders | 2,614 Kb |
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!
Name | Username | Size |
Sinclair Research Computers | MattCowley | 3,068 Kb |
Adding Items | Valhead | 4,008 Kb |
CSS Variables | Jdsteinbach | 4,759 Kb |
Parallax.js | Zmeeey5 | 2,330 Kb |
A Bouncy Menu Toggle | Billyysea | 4,563 Kb |
Count checked checkboxes with jQuery | Mestika | 2,343 Kb |
Arrow Navigation | Hinducows | 1,973 Kb |
Canvas Orbital Trails v2 | Jackrugile | 3,421 Kb |
Table Exercise | Fresco | 9,585 Kb |
Blockquote design | Sjmcpherson | 1,863 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!