-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
vinay
committed
Jan 9, 2024
1 parent
a5801ba
commit 94b3203
Showing
2 changed files
with
27 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,49 @@ | ||
def concatenate_example(string) | ||
# use concatenation to format the result to be "Classic <string>" | ||
"Classic " << string | ||
"Classic " + string | ||
end | ||
|
||
def concatenate(string) | ||
"Hello #{string}!" | ||
# use concatenation to format the result to be "Hello <string>!" | ||
end | ||
|
||
def substrings(word) | ||
word[0..3] | ||
# return the first 4 letters from the word using substrings | ||
end | ||
|
||
def capitalize(word) | ||
word.capitalize | ||
# capitalize the first letter of the word | ||
end | ||
|
||
def uppercase(string) | ||
string.upcase | ||
# uppercase all letters in the string | ||
end | ||
|
||
def downcase(string) | ||
string.downcase | ||
# downcase all letters in the string | ||
end | ||
|
||
def empty_string(string) | ||
string.empty? | ||
# return true if the string is empty | ||
end | ||
|
||
def string_length(string) | ||
string.length | ||
# return the length of the string | ||
end | ||
|
||
def reverse(string) | ||
string.reverse | ||
# return the same string, with all of its characters reversed | ||
end | ||
|
||
def space_remover(string) | ||
string.split.join("") | ||
# remove all the spaces in the string using gsub | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters