From 1a9467016d94f8f8171b45f2ce42f35e4c9107c2 Mon Sep 17 00:00:00 2001 From: Kenji Rikitake Date: Tue, 22 May 2018 11:59:52 +0900 Subject: [PATCH] Use pattern match for info_dispatch/1 --- src/aprs_is_decode.erl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/aprs_is_decode.erl b/src/aprs_is_decode.erl index 63a3c0d..940ce1d 100644 --- a/src/aprs_is_decode.erl +++ b/src/aprs_is_decode.erl @@ -20,11 +20,11 @@ decode_header(D, {CPS, CPI, CPR, CPEND}) -> {Source, Destination, Relay, Info}. info_dispatch(Info) -> - case binary:at(Info, 0) of - $! -> first_exclamation(Info); + <> = Info, + case Type of + $! -> first_exclamation(Rest); _ -> undefined end. -first_exclamation(Info) -> - Info, - true. +first_exclamation(Rest) -> + Rest.