korea_super_formatter 1.0.1
korea_super_formatter: ^1.0.1 copied to clipboard
Korean-specific formatters for Flutter. Supports KRW currency, phone numbers, dates, privacy masking, business numbers, and more.
// ignore_for_file: avoid_print
import 'package:korea_super_formatter/korea_super_formatter.dart';
void main() {
// KRW Currency Formatting
print(KrwFormatter.format(1234567)); // 1,234,567원
print(KrwFormatter.toKorean(123456789)); // 1억 2,345만 6,789원
print(KrwFormatter.toKoreanCompact(1500000000000)); // 1.5조
// Phone Number Formatting
print(PhoneFormatter.format('01012345678')); // 010-1234-5678
print(PhoneFormatter.getType('01012345678')); // mobile
print(PhoneFormatter.getType('15881234')); // special
// Date Formatting
final now = DateTime.now();
print(DateFormatter.format(now)); // 2024.01.15
print(DateFormatter.formatFull(now)); // 2024년 1월 15일
print(DateFormatter.formatWithDay(now)); // 2024.01.15 (월)
// Relative Time
final pastTime = DateTime.now().subtract(const Duration(hours: 3));
print(RelativeTime.format(pastTime)); // 3시간 전
print(RelativeTime.formatSmart(pastTime)); // 3시간 전
// Privacy Masking
print(PrivacyMasker.name('홍길동')); // 홍*동
print(PrivacyMasker.phone('01012345678')); // 010-****-5678
print(PrivacyMasker.email('test@example.com')); // te**@example.com
print(PrivacyMasker.rrn('9012151234567')); // 901215-1******
print(PrivacyMasker.card('1234567890123456')); // 1234-****-****-3456
// Number Formatting
print(NumberFormatter.format(1234567)); // 1,234,567
print(NumberFormatter.toKorean(123456789)); // 1억 2,345만 6,789
// Percent Formatting
print(PercentFormatter.format(12.34)); // 12.34%
print(PercentFormatter.formatSigned(5.0)); // +5.00%
print(PercentFormatter.formatSigned(-3.0)); // -3.00%
// Business Number Formatting
print(BusinessFormatter.formatBrn('1234567890')); // 123-45-67890
print(BusinessFormatter.isValidBrn('1234567890')); // true/false
print(BusinessFormatter.getBankName('090')); // 카카오뱅크
}