Skip to content

Commit

Permalink
Add hints to phone-number exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
abo64 committed Dec 2, 2016
1 parent d4f60ce commit 6c94e25
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions exercises/phone-number/HINTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Hints
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.
Some examples:
- `filter` instead of `replaceAll`
- `take`, `takeRight`, `drop`, `head`, `tail` instead of `substring`

Another idea worth exploring might be to change the `String` into a `List[Char]`
and then use [pattern matching](http://alvinalexander.com/scala/how-to-use-lists-nil-cons-scala-match-case-expressions) with the `::` operator.

0 comments on commit 6c94e25

Please sign in to comment.