Skip to content

Latest commit

 

History

History
 
 

strings-1

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

String Gymnastics 1

Introduction

Typically what makes our application unique is based on the input they ask for and what they do with it. Working with strings is something that we do on a daily basis. Luckily Ruby has some great support for string handling and manipulation.

This video shows some of those methods in action.

Objectives

  • Start to become familiar with the String API
  • Dig deeper into what the collections APIs can do for you:

Exercise

Using the code supplied in string-gymnastics-1.rb, use the shopping list in conjunction with the price list to calculate the total price of the shopping.

At the end of your script simply print a line of the format:

The price of the shopping list is: £pounds.pence.

Note: this time round, the shopping list is in a string instead of an array. You are going to need to use the String API to get back to something you can work with.