I am trying to write a function in Mathematica that takes a string and removes any spaces and punctuations and also turns capital letters into their lowercase equivalents, and keeps all lower case letters. This is what I have so far, and it doesn't seem to work.
formatText[plaintext_] := Module[{c = ToCharacterCode[plaintext], x = 0, z = {}},
While[x < StringLength[plaintext], If [c[[x]] <= 64 || 91 <= c[[x]] <= 96 || c[[x]] >= 123,
c[[x]] = 0, //here I just need it to do nothing
If[65 <= c[[x]] <= 90, Append[z, c[[x]] + 32],
Append[z, c[[x]]]]]; x = x++;]; FromCharacterCode[z]];
Any help is appreciated.