reference_parser 3.0.4 copy "reference_parser: ^3.0.4" to clipboard
reference_parser: ^3.0.4 copied to clipboard

A package that allows you to parse strings for bible references or match them to their bible verses. Can parse varying formats of references and multiple references at a time.

example/main.dart

import 'package:reference_parser/reference_parser.dart';

void main() {
  //Parse Reference
  var ref = parseReference('The most recited verse is Jn 3:16');
  print(ref.book); // 'John'
  print(ref.bookNumber); // 43
  print(ref.startChapterNumber); // 3
  print(ref.startVerseNumber); // 16
  print(ref.isValid); // true

  ref = parseReference('1john 4:5');
  print(ref.book); // '1 John'

  //Variant Spellings
  ref = parseReference('Songs 2:1');
  print(ref.reference); // 'Song of Solomon 2:1'

  //Range of verses
  ref = parseReference('Gen 4:5-10');
  print(ref.reference); // 'Genesis 4:5-10'
  print(ref.startVerseNumber); // 5
  print(ref.endVerseNumber); // 10

  //Book and chapter references
  ref = parseReference('Ps 1');
  print(ref.reference); // 'Psalms 1';
  print(ref.startVerseNumber); // 1
  print(ref.endVerseNumber); // 6

  //Book References
  ref = parseReference('gn');
  print(ref.reference); // 'Genesis'

  //Validation
  ref = parseReference('Joseph 2:4');
  print(ref.book); // Joseph
  print(ref.bookNumber); // null
  print(ref.isValid); // false

  ref = parseReference(' This is Genesis 1:100');
  print(ref.isValid); // false

  //Create Reference
  ref = Reference('1Co', 3, 4, 5);
  print(ref.book); //'1 Corinthians'
  print(ref.startChapterNumber); // 3
  print(ref.startVerseNumber); // 4
  print(ref.endVerseNumber); // 5

  var refs =
      parseAllReferences('This is going to get Gen 2:4 and another book');
  print(refs); // ['Isaiah', 'Genesis 2:4'], 'is' will be parsed as Isaiah
}
12
likes
130
pub points
53%
popularity

Publisher

verified publisherpetit.dev

A package that allows you to parse strings for bible references or match them to their bible verses. Can parse varying formats of references and multiple references at a time.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

html, http

More

Packages that depend on reference_parser