Browse Source

reformating and notions

content-update
Chris 3 years ago
parent
commit
c4c7fabfd0
  1. 12
      subjects/ownership/README.md

12
subjects/ownership/README.md

@ -2,10 +2,14 @@
### Instruction ### Instruction
- Create a function that takes ownership of a string and returns the first sub-word in it - Create a **function** that takes ownership of a string and returns the first sub-word in it
- It should work for `camelCase` as well as `snake_case` - It should work for `camelCase` as well as `snake_case`
### Notions
- [ownership](https://doc.rust-lang.org/book/ch04-00-understanding-ownership.html)
### Expected Function ### Expected Function
```rust ```rust
@ -15,9 +19,11 @@ pub fn first_subword(mut s: String) -> String {
### Usage ### Usage
Here is a program to test your function Here is a program to test your function:
```rust ```rust
use ownership::first_subword;
fn main() { fn main() {
let s1 = String::from("helloWorld"); let s1 = String::from("helloWorld");
let s2 = String::from("snake_case"); let s2 = String::from("snake_case");
@ -31,7 +37,7 @@ fn main() {
} }
``` ```
And its output And its output:
```console ```console
student@ubuntu:~/[[ROOT]]/test$ cargo run student@ubuntu:~/[[ROOT]]/test$ cargo run

Loading…
Cancel
Save