Search packages, repositories and app categories

Package detailsv4.2.0

strings

Large collection of String functions aimed at extending the String class whilst providing safer methods for working with nullable Strings.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
157K
Likes
58
Pub points
160

Install package

flutter pub add strings

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The strings package provides an extensive set of utility functions that extend the Dart String class, offering safer and more convenient methods for handling both non-null and nullable strings. It enhances string manipulation with null-safe operations, reducing the risk of runtime errors. The package is designed to streamline common text processing tasks, such as trimming, splitting, validating, and transforming strings, while maintaining clean and readable code. Ideal for developers seeking to improve string handling across multiple platforms.

Use cases

  • String validation
  • Null-safe string operations
  • Text formatting
  • Data parsing
  • Input sanitization
  • Internationalization support

Key features

  • Extends String class with additional methods
  • Null-safe utilities
  • Comprehensive string manipulation
  • Cross-platform compatibility
  • Easy integration via pub
  • Well-documented API

Suitable for

  • Web and mobile app development
  • Form input processing
  • API data handling
  • Text transformation workflows
  • Developers prioritizing code safety

Considerations

  • Requires understanding of null safety
  • May add slight overhead for simple cases
  • Limited to string-specific utilities
  • Not intended for complex regex or pattern matching
  • Best suited for projects already using null safety

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

The Strings package is an evolution of the work originally produced by Andrew Mezoni.

The purpose of the Strings package is to provide:

  • a collection of useful String functions to complement the core String class.
  • where viable, directly extend the String class with methods such as String.right, String.left...
  • provide a safer environment when working with nullable Strings (String?)
  • wrappers for each of the core String methods which are safe to use with a nullable String?.

A core objective of the Strings package is to never 'throw' or return an error but to make a best effort to process the passed data.

// passing null works too.
Strings.right(null, 4, pad: Pad.left);
 -> '    '

// pass a short string and we can pad it (or not).
Strings.right('one', 4, pad: Pad.left);
 -> ' one'

The Strings package also includes a number of methods exposed as extensions to the core Dart String class:

'a normal string'.right(4);
-> 'a no'

See the full list

The Strings package incudes over 50 functions.

You can see the full list including examples at:

strings.onepub.dev

Contributing:

The strings package is hosted on github at: github.com/onepub-dev/strings

Contributions are welcomed.

Sponser

The strings package is sponsored by OnePub - the private Dart repository SaaS.

onepub.dev

OnePub Logo

Categories

Dependencies

Dependency list 2 items

Source repository

Projects using this package