String Filter For Character Set

From Erlang Community

(Difference between revisions)
Revision as of 21:53, 3 September 2006 (edit)
Bfulgham (Talk | contribs)

← Previous diff
Revision as of 00:20, 22 November 2006 (edit) (undo)
Kaiserpanda (Talk | contribs)
m
Next diff →
Line 17: Line 17:
[[Category:CookBook]][[Category:StringRecipes]] [[Category:CookBook]][[Category:StringRecipes]]
 +
 +
 +
 +[http://www.magical-casino.com/choosing_casino.html Online Casino - Choosing the best casinos.]
 +[http://www.slots-wiki.com/index.php/slots_tips slots tips]
 +[http://www.magical-casino.com/no_deposit.html Casinos with no deposit required.]
 +[http://www.casino-theory.com/online-casino-bonus/free-online-casino-tournament.html free online casino tournament]
 +[http://www.3wcasinos.com/roulette-tips/roulette-description.html roulette description]
 +[http://www.casinos-go.com/online-casino-tips/online-casino-games.html online casino games]
 +[http://www.slots-wiki.com/index.php/slots_online slots online]
 +[http://www.magical-casino.com/strategy.html Online casino strategies.]
 +[http://www.casino-theory.com/bingo-online/gambling-online-bingo.html gambling online bingo]
 +[http://www.online-casino-wiki.com/index.php/online_casino_tips online casino tips]

Revision as of 00:20, 22 November 2006

Problem

You want to remove all but a specified set of characters from a string.

Solution

This is really a extension of what we talked about in StringCheckForChar. The Erlang lists module provides several functions that allow manipulations of strings (since they are simply lists of characters). For example, to remove non-letters from a string, we could define a predicate that recognizes only letters:

1> lists:filter(fun(X) -> lists:member(X, 
1>     "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") end,
1>     "Hello, World!").
"HelloWorld"
37> lists:filter(fun(X) -> not lists:member(X,
37> "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") end,
37> "Hello, World!").
", !"


Online Casino - Choosing the best casinos. slots tips Casinos with no deposit required. free online casino tournament roulette description online casino games slots online Online casino strategies. gambling online bingo online casino tips

Erlang/OTP Projects
Personal tools