forked from root/public
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
…
|
||
---|---|---|
.. | ||
README.md |
README.md
name_initials
Instructions
Create a function named initials
. This function will receive a vector of string literals with names, and return a vector of Strings with the initials of each name.
Expected Functions
pub fn initials(names: Vec<&str>) -> Vec<String> {
}
Your heap allocations will be monitored to ensure that you do not make too many allocations, and that your allocations are reasonably sized.
Usage
Here is a program to test your function:
use name_initials::initials;
fn main() {
let names = vec!["Harry Potter", "Someone Else", "J. L.", "Barack Obama"];
println!("{:?}", initials(names));
}
And its output
$ cargo run
["H. P.", "S. E.", "J. L.", "B. O."]
$