Browse Source

docs(string_literals): correct grammar

DEV-3198-new-go-exercise-get-digit-len
davhojt 2 years ago committed by Dav Hojt
parent
commit
0a6a990828
  1. 27
      subjects/string_literals/README.md

27
subjects/string_literals/README.md

@ -4,21 +4,11 @@
Create the following functions: Create the following functions:
- `is_empty`, that returns true if a string is empty - `is_empty`: that returns `true` if the string is empty.
- `is_ascii`, that returns true if all characters of a given string is in ASCII range - `is_ascii`: that returns `true` if all characters are within the ASCII range.
- `contains`, that returns true if the string contains a pattern given - `contains`: that returns `true` if the string contains the given pattern.
- `split_at`, that divides a string in two returning a tuple - `split_at`: that divides a string in two returning a tuple.
- `find', that returns the index if the first character of a given string that matches the pattern - `find`: that returns the index if the first character of a given string that matches the pattern.
> This exercise will test how many times the **heap is going to be allocated**!\
> So try your best to allocate the minimum data on the heap!
### Notions
- [stack and heap](https://doc.rust-lang.org/1.22.0/book/first-edition/the-stack-and-the-heap.html)
- [Literals](https://doc.rust-lang.org/rust-by-example/primitives/literals.html)
### Expected Functions
```rust ```rust
pub fn is_empty(v: &str) -> bool { pub fn is_empty(v: &str) -> bool {
@ -37,6 +27,8 @@ pub fn find(v: &str, pat: char) -> usize {
} }
``` ```
> Your heap allocations will be monitored to ensure that you do not make too many allocations, and that your allocations are reasonably sized.
### Usage ### Usage
Here is a program to test your function Here is a program to test your function
@ -64,3 +56,8 @@ true
1 1
$ $
``` ```
### Notions
- [stack and heap](https://doc.rust-lang.org/1.22.0/book/first-edition/the-stack-and-the-heap.html)
- [Literals](https://doc.rust-lang.org/rust-by-example/primitives/literals.html)

Loading…
Cancel
Save