https://github.com/hofmannz/morse-code
A library that converts morse code encoded strings to regular decoded strings.
https://github.com/hofmannz/morse-code
dart morse morse-code
Last synced: 8 months ago
JSON representation
A library that converts morse code encoded strings to regular decoded strings.
- Host: GitHub
- URL: https://github.com/hofmannz/morse-code
- Owner: HofmannZ
- License: mit
- Created: 2018-06-16T17:53:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-04T19:26:08.000Z (over 6 years ago)
- Last Synced: 2023-08-20T22:34:06.490Z (about 2 years ago)
- Topics: dart, morse, morse-code
- Language: Dart
- Size: 9.77 KB
- Stars: 8
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Morse Code
[![version][version-badge]][package]
[![MIT License][license-badge]][license]
[![PRs Welcome][prs-badge]](http://makeapullrequest.com)[![Watch on GitHub][github-watch-badge]][github-watch]
[![Star on GitHub][github-star-badge]][github-star]## Usage
Fist depend on the libary by ading this to your package's `pubspec.yaml`:
```yaml
dependencies:
morse_code: ^0.1.0
```Now inside your Dart code you can import it.
```dart
import 'package:morse_code/morse_code.dart';
```For this example we're going to use the following morse code string:
```dart
final String encodedMessage = '.... . .-.. .-.. --- / .-- --- .-. .-.. -..';
```There are two ways to decode a morse code string. Either provide de encoded string as an argument to the constructor, and call the `decode` method.
```dart
final Morse morse = new Morse(encodedMessage);
String decodedMessage = morse.decode();// Or combine the two, for more compact code:
String decodedMessage = new Morse(encodedMessage).decode();
```Or provide the encoded string as an argument to the `decode` method.
```dart
final Morse morse = new Morse();
String decodedMessage = morse.decode(encodedMessage);// Or again combine the two, for more compact code:
String decodedMessage = new Morse().decode(encodedMessage);
```## Contributing
Feel free to open a PR with any suggetions!
[version-badge]: https://img.shields.io/pub/v/morse_code.svg?style=flat-square
[package]: https://pub.dartlang.org/packages/morse_code
[license-badge]: https://img.shields.io/github/license/HofmannZ/morse-code.svg?style=flat-square
[license]: https://github.com/HofmannZ/morse-code/blob/master/LICENSE
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[prs]: http://makeapullrequest.com
[github-watch-badge]: https://img.shields.io/github/watchers/HofmannZ/morse-code.svg?style=social
[github-watch]: https://github.com/HofmannZ/morse-code/watchers
[github-star-badge]: https://img.shields.io/github/stars/HofmannZ/morse-code.svg?style=social
[github-star]: https://github.com/HofmannZ/morse-code/stargazers