acronym 0.3.0 acronym: ^0.3.0 copied to clipboard
A simple, lightweight and easy to use package to generate acronyms.
A simple, lightweight and easy to use package to generate acronyms.
Usage #
You can use it with the standard arguments to generate your acronym:
import 'package:acronym/acronym.dart';
const String input = "The United States of America";
final String output = generateAcronym(input);
print(output); // "USA"
Sample usage with the extension:
import 'package:acronym/acronym.dart';
const String input = "The United States of America";
final String output = input.toAcronym();
print(output); // "USA"
You can use it with stop words like this:
import 'package:acronym/acronym.dart';
const String input = "The United States of America";
final String output1 = input.toAcronym(stopWords: stopWords);
final String output1 = generateAcronym(input, stopWords: stopWords);
print(output); // "USA"
Add your own stop words:
import 'package:acronym/acronym.dart';
const String input = "The United States of America";
final List<String> stopWords = [...stopWords, "states"];
final String output = input.toAcronym(stopWords: stopWords);
print(output); //UA
If you want to generate the Acronym without any words you can do it like this
import 'package:acronym/acronym.dart';
const String input = "The United States of America";
final String output = input.toAcronym(stopWords: []);
print(output); //TUSOA