Skip to content

Commit f033ff2

Browse files
authored
Merge pull request ashutosh97#95 from luminousbeam/master
Added Acronym problem
2 parents 875ca64 + 4031662 commit f033ff2

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

Acronym/instructions.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Acronym
2+
Convert a phrase to its acronym.
3+
4+
Techies love their TLA (Three Letter Acronyms)!
5+
6+
Help generate some jargon by writing a program that converts a long name like Portable Network Graphics to its acronym (PNG).

Acronym/ruby_solution.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def abbreviate(string)
2+
string_arr = string.scan(/\b\w/)
3+
string_arr.join.upcase
4+
end
5+
6+
7+
# begin
8+
# >> abbreviate("Portable Network Graphics")
9+
# => "PNG"
10+
# >> abbreviate("Ruby on Rails")
11+
# => "ROR"
12+
# >> abbreviate("GNU Image Manipulation Program")
13+
# => "GIMP"

0 commit comments

Comments
 (0)