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 ...

Get Programming Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.