Is there any easy way to create an acronym from a string?
First_name Middle_name Last_name => FML first_name middle_name last_name => FML First_name-Middle_name Last_name => F-ML first_name-middle_name last_name => F-ML
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.
Does language-agnostic means you have to use pseudocode? If not, then in Ruby:
'First_name-Middle_nameLast_name'.gsub('-', ' - ').gsub(/\B[A-Z]+/, ' \&').split(' ').map { |s| s[0..0] }.join.upcase => 'F-ML'If it turns out the lack of space in the third example is a typo, you can skip the second call to
gsub(with the ugly regexp.)