From a4550a8fc4253ddc96597326aeaaeb395daab25e Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Wed, 13 Mar 2019 14:46:54 +0800 Subject: [PATCH] Add emqx_topic:tokens/1 function --- src/emqx_topic.erl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/emqx_topic.erl b/src/emqx_topic.erl index 913946a79..6679b893f 100644 --- a/src/emqx_topic.erl +++ b/src/emqx_topic.erl @@ -157,6 +157,11 @@ levels(Topic) when is_binary(Topic) -> tokens(Topic) -> binary:split(Topic, <<"/">>, [global]). +%% @doc Split topic to tokens. +-spec(tokens(topic()) -> list(binary())). +tokens(Topic) -> + binary:split(Topic, <<"/">>, [global]). + %% @doc Split Topic Path to Words -spec(words(topic()) -> words()). words(Topic) when is_binary(Topic) ->