4
$\begingroup$

While working on How to capitalize the first letter of each word in a string and trying to understand why certain characters were not considered letters I tried this:

StringCases["áéíóöőüű", _?LetterQ]
LetterQ::string: String expected at position 1 in LetterQ[Removed[$$Failure]]. >>

LetterQ::string: String expected at position 1 in LetterQ[Removed[$$Failure]]. >>

LetterQ::string: String expected at position 1 in LetterQ[Removed[$$Failure]]. >>

General::stop: Further output of LetterQ::string will be suppressed during this calculation. >>

{}

I then tried a Print function to see what was going on:

StringCases["áéíóöőüű", _?Print];
á  
é  
í  
ó  
ö  
ő  
ü  
ű  

No errors. Then I tried a function that Prints, but returns True:

StringCases["áéíóöőüű", _?((Print["(", FullForm@#, ")"]; True) &)]

This produced interleaved lines of characters (expected) and Removed[$$Failure] (not expected). I can't include the output properly because of this StackExchange bug.

  • What is the cause of this?

  • Has it been fixed since version 7?

$\endgroup$
  • $\begingroup$ Does not happen for me (v8.0.4 Linux64). StringCases["áéíóöőüű", _?LetterQ] == Characters["áéíóöőüű"] $\endgroup$ – ssch Sep 10 '13 at 14:30
  • $\begingroup$ I get the same message for MMA 7.0 on mac OSX, but in version 9.0.0 it works fine. $\endgroup$ – Jacob Akkerboom Sep 10 '13 at 14:34
  • $\begingroup$ There is no explicit Removed[$$Failure] at all under Win7, v9.0.1. $\endgroup$ – István Zachar Sep 10 '13 at 14:49
  • $\begingroup$ No problems in either 8 or 9 (Win7-64). BTW I remember researching related matters. See my comments here. $\endgroup$ – Sjoerd C. de Vries Sep 10 '13 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.