XuGongTeJi_flutter/lib/utils/stringUtils.dart

24 lines
422 B
Dart
Raw Normal View History

2025-02-19 18:52:05 +08:00
import 'dart:convert';
class StringUtils {
/// 字符串转换为 json
static String toJson(Object object) {
return jsonEncode(object);
}
static bool isEmpty(String? value) {
if (value == null || value == "") {
return true;
}
return false;
}
static bool isNumber(String? value) {
if (isEmpty(value)) {
return false;
}
return RegExp(r'^\d+$').hasMatch(value!);
}
}