On Sun, 2011-10-09 at 07:36 -0700, jingguo wrote: > Does clojure has a API for this? I have checked clojure.core and > clojure.string. > It seems that clojure does not have a counterpart for indexOf.
No, it doesn't. There's usually a way to do string operations that you traditionally do with indexOf using other tools like regular expressions; these also have the benefit of helping you avoid fencepost errors. For example, if you wanted all the text before and after "12" in a string, you could match #"(?s)(.*?)12(.*)". That aside, while the lack of a Clojure-level facility should give you a nudge to consider such alternatives, it's perfectly fine to call Java when needed. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en