Created
March 22, 2017 20:50
-
-
Save bobfirestone/c705939babcd57eea7e4d3e39c460595 to your computer and use it in GitHub Desktop.
Palindrome problem for week 2 section 15 of FUNCTIONAL PROGRAMMING IN ERLANG THE UNIVERSITY OF KENT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(two_15). | |
-export([palindrome/1]). | |
palindrome(String)-> | |
Fs = formattedString(String), | |
Fs == lists:reverse(Fs). | |
formattedString(String) -> | |
% remove all spaces & non-word chars | |
re:replace(string:to_lower(String), "\\s+|\\W", "", [global,{return,list}]). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment