title: How to check that a string contains only certain characters in Prolog?
body: <p>I want to write a predicate <code>containsOnly(X,Y)</code>, which returns true, if string <code>X</code> contains only characters from string Y.</p>
  
  <p>I wrote it this way:</p>
  
  <pre><code>containsOnly([],_).
  containsOnly([H|T],AcceptableCharacters) :- 
      member(H, AcceptableCharacters),
      containsOnly(T,AcceptableCharacters).
  </code></pre>
  
  <p>But the queries below return false. How can I modify the predicate in order for them to return true?</p>
  
  <pre><code>containsOnly('A', 'ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜabcdefghijklmnopqrstuvwxyzäöüАБВГДЕЁЖЗИКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзиклмнопрстуфхцчшщъыьэюя-').
  containsOnly('a', 'ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜabcdefghijklmnopqrstuvwxyzäöüАБВГДЕЁЖЗИКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзиклмнопрстуфхцчшщъыьэюя-').
  </code></pre>