Skip to content

Commit 6c94e25

Browse files
committed
Add hints to phone-number exercise
1 parent d4f60ce commit 6c94e25

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

exercises/phone-number/HINTS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Hints
2+
For simplicity and readability: Consider using the Scala collection functions instead of Java's `String` methods. Remember that in Scala is implicitly also a `Seq[Char]`, so you can call them as easily as the `String` methods.
3+
Some examples:
4+
- `filter` instead of `replaceAll`
5+
- `take`, `takeRight`, `drop`, `head`, `tail` instead of `substring`
6+
7+
Another idea worth exploring might be to change the `String` into a `List[Char]`
8+
and then use [pattern matching](http://alvinalexander.com/scala/how-to-use-lists-nil-cons-scala-match-case-expressions) with the `::` operator.

0 commit comments

Comments
 (0)