Skip to main content
edited title
Link
HyperGroups
  • 8.7k
  • 1
  • 29
  • 64

little problem with message about string expected in pattern

Source Link
HyperGroups
  • 8.7k
  • 1
  • 29
  • 64

little problem with string in pattern

names=Select[(StringCases[list2=Names["System`*"],RegularExpression["[a-z]+"],IgnoreCase->True]//Flatten),MemberQ[list2,#]&]; namesReplaceRules=names/.x_String->(x->"`"<>x<>"`"); 

I found it will generate the message, but also gives the right result in this case.

StringJoin::string: String expected at position 2 in <>x<>. >>

I can Use Quiet or Ignore the message, or Add one ToString to x

namesReplaceRules=names/.x_String->(x->"`"<>x<>"`"); 

Which is the right choice in such a case?

More elegant codes?