Ruby Coding Exercise: Add the Next Letter or Number in a String Sequence in Ruby

0
1433

In this Ruby coding exercise you’ll learn how to add the next element in a sequence of numbers or letters.

Summary

Build a method that takes in a sequenced string of letters or numbers and returns a string that contains the input string with the next element in the sequence.

Exercise File

Code File

Exercise Description

Given the following string:

"abc"

Write a method that returns the next element in the string concatenated with the input string.

Sample Output

"abcd"

Real World Usage

String manipulation is utilized in Ruby development on a regular basis. There are some build in methods in Ruby that come close to delivering this behavior, however you need to extend their functionality to get the desired behavior.

Solution

Can be found on the solutions branch on github.

LEAVE A REPLY

Please enter your comment!
Please enter your name here