Algorithm Exercise 3: Palindromic Algorithms

Returns if the given string is a palindrome true, otherwise, returns false.

A palindrome is a string that ignores punctuation, capitalization, and spaces, and reads exactly the same forward and backward.

 

Note: You need to remove extra punctuation and spaces from the string, and then convert the string to lowercase to verify that the string is a palindrome.

usage instructions:

replace() The method returns a new string with some or all of the matched patterns replaced by the replacement value. The pattern can be a string or a regular expression, and the replacement value can be a string or a function to be called for each match. Note: The original string will not be changed.

toLowerCase() Converts the string value calling this method to lowercase and returns it.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325300645&siteId=291194637