搜索插件、代码仓与 APP 分类

插件详情v0.4.7

vy_string_utils

一组简单的字符串及其他类型工具。

AndroidiOSLinuxmacOSWebWindows
近 30 天下载
8.7万
喜欢数
2
Pub 分数
160

安装插件

flutter pub add vy_string_utils

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个轻量级的 Flutter/Dart 包,提供一组用于字符串操作及其他基本类型操作的简单工具。它提供了处理常见任务(如修剪、验证、格式化和转换字符串)的实用方法,提升代码可读性并减少样板代码。设计简洁,易于集成到任何 Dart 项目中,支持所有主要平台,包括 Android、iOS、Web 和桌面环境。非常适合希望快速获得可靠字符串处理工具且不依赖重型库的开发者。

适合场景

  • 字符串验证
  • 文本格式化
  • 输入净化
  • 数据转换
  • 简单的文本处理
  • 跨平台字符串工具

主要特点

  • 易于使用的实用函数
  • 支持多个平台
  • 最小依赖足迹
  • 简洁且可读的 API
  • 专注于字符串和基本类型操作
  • 文档齐全的方法

适合对象

  • 初级到中级 Dart 开发者
  • 需要基本字符串帮助函数的项目
  • 需要一致文本处理的应用程序
  • 轻量级实用工具需求
  • 快速原型设计
  • Web 和移动应用

使用建议

  • 不适用于复杂解析
  • 仅限基本操作
  • 不支持高级正则表达式或国际化
  • 最适合简单的用例
  • 不替代功能齐全的文本处理库

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

README

A collection of string utilities.

These utilities simplifies some formatting needs. The main methods are:

  • cut() -> Cuts a String at the required length if bigger or returns the origin otherwise.

  • cutAndAlign() -> Cuts a String or pads it right or left with a certain character to the required length if needed

  • preserveOnlyChars() -> returns a String containing only the required characters. Optionally the removed characters can be substituted by a placeholder.

  • splitInLines() -> split a sentence in lines of the required length based on a given separator.

  • capitalize() -> Capitalize the first character of the string and lowercase the others.

  • onlyContainsDigits() -> returns true if the string contains only digits.

  • onlyContainsAlpha() -> returns true if the string only contains alpha characters (RegExp [a-zA-Z])

  • isDartIdentifier() -> returns true if the characters starting at the given position are a valid Dart identifier.

  • getDartIdentifier() -> return the valid Dart identifier (if any) at certain position in a source string.

    All these methods are presented also as extensions.

license.

Usage

A simple usage example:

import 'package:vy_string_utils/vy_string_utils.dart';

main() {
  print('please cut'.cutAndAlign(15, paddingChar: '*')); // 'please cut*****'

  print('main'.capitalize()); // 'Main'

  print('1953'.onlyContainsDigits()); // true
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。

所在榜单