Files
huangguo_android/lib/hj_utils/text_util.dart
T
2026-09-15 15:44:13 +07:00

18 lines
545 B
Dart

/// 文本处理工具类
class TextUtil {
static bool isEmpty(String? text) {
return (null == text || text.isEmpty);
}
static bool isNotEmpty(String? text) {
return (null != text && text.isNotEmpty);
}
}
/// 解析后端下发的字符串数组:非数组(null/空串/对象/数字)一律给空数组,
/// 数组内的 null 丢掉,非字符串元素转字符串
List<String> parseStringList(dynamic value) {
if (value is! List) return [];
return value.where((e) => e != null).map((e) => e.toString()).toList();
}