Something less imperative than this:
def subs(s: String) = for {start <- 0 to s.length; end <- i to s.length} yield s.substring(start, end)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to remove empty strings:
But note that this incantation is not so obvious to the reader, as @Randall Schulz points out in comments. Your original version, on the other hand, is instantly clear.