Skip to content

umm-csci-3403-fall-2019/lab-9-disemvowel-in-rust-metalpun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple lab using Rust to manipulate strings

This is a very simple lab where we'll use Rust to implement the disemvowel function that we covered in a previous C lab.

The initial code has a main.rs that has a main function and a set of tests for a (missing) disemvowel function. You should write the missing disemvowel function so that the tests all pass.

Use cargo test to run the tests.

The solution is just a few lines. There are no doubt a lot of different ways to do this, and I don't claim to know Rust well enough to know the "right" or "best" way. That said, I found the following things useful:

  • Creating a vector of vowels
  • Iterating over the characters in the input string using .chars()
  • Pushing non-vowel characters onto an initially empty string

I found this StackExchange answer useful, although I preferred the use of contains in the code from the original poster. Your mileage may vary.

About

Nic - my work is in the "new" branch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages