Skip to content

An SMS message splitter and part calculator with support for GSM and Unicode

License

Notifications You must be signed in to change notification settings

Aitthi/sms-splitter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMS Splitter

Documentation Version NPM version License

An SMS message splitter with support for both GSM and Unicode written in Rust. GSM support is limited to GSM 03.38 with the extension table (see the Wikipedia article)

Installation and Usage in Rust

cargo add sms_splitter
use sms_splitter::SplitSms;

fn main(){
    let info = SplitSms::default().split("Hello World!".to_string());
    println!("{:#?}", info);
}
SplitSmsResult {
    character_set: "GSM",
    parts: [
        SplitterPart {
            content: "Hello World!",
            length: 12,
            bytes: 12,
        },
    ],
    bytes: 12,
    length: 12,
    remaining_in_part: 148,
}

Installation and Usage in NodeJs

npm install sms-splitter-wasm

or

yarn add sms-splitter-wasm
import { SmsSplitter } from "sms-splitter-wasm";

const message = "Hello World!";
const splitter = new SmsSplitter();
console.log(splitter.split(message));
{
  "character_set": "GSM",
  "parts": [ { "content": "Hello World!", "length": 12, "bytes": 12 } ],
  "bytes": 12,
  "length": 12,
  "remaining_in_part": 148
}

Credits

A lot of the code in this package was based on Codesleuth split-sms.