View Source SmsPartCounter (sms_part_counter v0.1.4)
Module for detecting which encoding is being used and the character count of SMS text.
Link to this section Summary
Functions
Counts the characters in a string.
Detects the encoding of the SMS then counts the part, returns all information as a map of the following format: %{ "encoding" => encoding, "parts" => part count }
Detects the encoding of the SMS message based on the charset of GSM 7 bit Encoding. It does a set difference between the characters in the sms and the gsm 7 bit encoding char set.
Counts the part of a message that's encoded with GSM 7 Bit encoding. The GSM 7 Bit Encoded messages have following length requirement: Signle SMS Part Length: 160 Chars Multi SMS Part Length: 153 Chars
Counts the part of a message that's encoded with Unicode encoding. The Unicode Encoded messages have following length requirement: Signle SMS Part Length: 70 Chars Multi SMS Part Length: 67 Chars
Link to this section Functions
Counts the characters in a string.
examples
Examples
iex> SmsPartCounter.count("Hello") 5 iex> SmsPartCounter.count("আম") 2
@spec count_parts(binary()) :: %{ required(String.t()) => String.t(), required(String.t()) => integer() }
Detects the encoding of the SMS then counts the part, returns all information as a map of the following format: %{ "encoding" => encoding, "parts" => part count }
examples
Examples
iex> SmsPartCounter.count_parts("abc") %{
"encoding" => "gsm_7bit",
"parts" => 1
}
@spec detect_encoding(binary()) :: {:ok | :error, Sting.t()}
Detects the encoding of the SMS message based on the charset of GSM 7 bit Encoding. It does a set difference between the characters in the sms and the gsm 7 bit encoding char set.
examples
Examples
iex> SmsPartCounter.detect_encoding("adb abc")
iex> SmsPartCounter.detect_encoding("আমি")
Counts the part of a message that's encoded with GSM 7 Bit encoding. The GSM 7 Bit Encoded messages have following length requirement: Signle SMS Part Length: 160 Chars Multi SMS Part Length: 153 Chars
examples
Examples
iex> SmsPartCounter.gsm_part_count("asdf") 1
Counts the part of a message that's encoded with Unicode encoding. The Unicode Encoded messages have following length requirement: Signle SMS Part Length: 70 Chars Multi SMS Part Length: 67 Chars
examples
Examples
iex> SmsPartCounter.unicode_part_count("আমি") 1