O'Reilly logo

Programming Elixir by Dave Thomas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Your Turn

  • Exercise: StringsAndBinaries-6

    Write a function to capitalize the sentences in a string. Each sentence is terminated by a period and a space. Right now, the case of the characters in the string is random.

     
    iex>​ capitalize_sentences(​"oh. a DOG. woof. "​)
     
    "Oh. A dog. Woof. "
  • Exercise: StringsAndBinaries-7

    Chapter 7, Lists and Recursion, had an exercise about calculating sales tax. We now have the sales information in a file of comma-separated id, ship_to, and amount values. The file looks like this:

     
    id,ship_to,net_amount
     
    123,:NC,100.00
     
    124,:OK,35.50
     
    125,:TX,24.00
     
    126,:TX,44.80
     
    127,:NC,25.00
     
    128,:MA,10.00
     
    129,:CA,102.00
     
    120,:NC,50.00

    Write a function that reads and parses this file and then passes the result to the sales_tax ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required