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.
Korea Super Formatter ๐ฐ๐ท #
Korean-specific formatters for Flutter. ํ๊ตญ ์๋น์ค์ ํนํ๋ ํฌ๋งทํฐ ํจํค์ง์ ๋๋ค.
โจ Features #
- ๐ฐ ๊ธ์ก ํฌ๋งทํฐ - ์ํ, ํ๊ธ ๋จ์ ํ๊ธฐ, ํ์ฑ
- ๐ ์์ต๋ฅ ํฌ๋งทํฐ - ํผ์ผํธ, ๋ถํธ ํฌํจ, ์์ ํฌํผ
- ๐ฑ ์ ํ๋ฒํธ ํฌ๋งทํฐ - ์๋ ํฌ๋งทํ , ๋ง์คํน, ์ ํจ์ฑ ๊ฒ์ฌ
- ๐ ์๋ ์๊ฐ ํฌ๋งทํฐ - "5๋ถ ์ ", "์ด์ ", "3์ผ ์ " ๋ฑ
- ๐ ๋ ์ง ํฌ๋งทํฐ - ํ๊ตญ์ ๋ ์ง ํ์, ์์ผ ํฌํจ
- ๐ข ์ซ์ ํฌ๋งทํฐ - ์ฒ ๋จ์ ๊ตฌ๋ถ, ํ๊ธ ๋จ์ ํ๊ธฐ
- ๐ ๊ฐ์ธ์ ๋ณด ๋ง์คํน - ์ด๋ฆ, ์ด๋ฉ์ผ, ์ ํ๋ฒํธ, ๊ณ์ข๋ฒํธ ๋ฑ
- ๐ข ์ฌ์ ์๋ฒํธ ํฌ๋งทํฐ - ํฌ๋งทํ , ์ ํจ์ฑ ๊ฒ์ฌ
๐ฆ Installation #
dependencies:
korea_super_formatter: ^1.0.0
flutter pub get
๐ Usage #
๐ฐ ๊ธ์ก ํฌ๋งทํฐ (KrwFormatter) #
import 'package:korea_super_formatter/korea_super_formatter.dart';
// ๊ธฐ๋ณธ ํฌ๋งท
KrwFormatter.format(1350000); // "1,350,000์"
KrwFormatter.format(1350000, unit: false); // "1,350,000"
// ํ๊ธ ๋จ์ ํ๊ธฐ
KrwFormatter.toKorean(135003000); // "1์ต 3,500๋ง 3,000์"
KrwFormatter.toKoreanCompact(135003000); // "1.35์ต"
// ๋ถํธ ํฌํจ
KrwFormatter.formatSigned(50000); // "+50,000์"
KrwFormatter.formatSigned(-30000); // "-30,000์"
// ํ์ฑ
KrwFormatter.parse("1์ต 3,500๋ง์"); // 135000000
๐ ์์ต๋ฅ ํฌ๋งทํฐ (PercentFormatter) #
// ๊ธฐ๋ณธ ํฌ๋งท
PercentFormatter.format(12.345); // "12.35%"
PercentFormatter.format(12.345, decimals: 1); // "12.3%"
// ๋ถํธ ํฌํจ
PercentFormatter.formatSigned(12.34); // "+12.34%"
PercentFormatter.formatSigned(-5.67); // "-5.67%"
// ์์ ํฌํผ
PercentFormatter.getColor(12.34); // Colors.red (์์น)
PercentFormatter.getColor(-5.67); // Colors.blue (ํ๋ฝ)
// ํ์ฑ
PercentFormatter.parse("+12.34%"); // 12.34
๐ฑ ์ ํ๋ฒํธ ํฌ๋งทํฐ (PhoneFormatter) #
// ํฌ๋งทํ
PhoneFormatter.format("01012345678"); // "010-1234-5678"
PhoneFormatter.format("0212345678"); // "02-1234-5678"
// ๋ง์คํน
PhoneFormatter.mask("01012345678"); // "010-****-5678"
PhoneFormatter.mask("01012345678", start: 3, end: 7); // "010-****-5678"
// ์ ํจ์ฑ ๊ฒ์ฌ
PhoneFormatter.isValid("01012345678"); // true
PhoneFormatter.isMobile("01012345678"); // true
๐ ์๋ ์๊ฐ ํฌ๋งทํฐ (RelativeTime) #
// ๊ธฐ๋ณธ ํฌ๋งท
RelativeTime.format(dateTime); // "5๋ถ ์ "
RelativeTime.format(dateTime); // "์ด์ "
RelativeTime.format(dateTime); // "3์ผ ์ "
// ์ค๋งํธ ํฌ๋งท
RelativeTime.formatSmart(dateTime);
// - 1๋ถ ๋ฏธ๋ง: "์ง๊ธ"
// - 1~59๋ถ: "N๋ถ ์ "
// - 1~23์๊ฐ: "N์๊ฐ ์ "
// - 1~3์ผ: "N์ผ ์ "
// - ๊ทธ ์ดํ: "3์ 15์ผ"
// ๋ฏธ๋ ์๊ฐ
RelativeTime.formatFuture(futureDate); // "5๋ถ ํ", "๋ด์ผ"
๐ ๋ ์ง ํฌ๋งทํฐ (DateFormatter) #
// ๊ธฐ๋ณธ ํฌ๋งท
DateFormatter.format(date); // "2024.03.15"
DateFormatter.formatFull(date); // "2024๋
3์ 15์ผ"
DateFormatter.formatWithDay(date); // "2024.03.15 (๊ธ)"
// ์๊ฐ ํฌํจ
DateFormatter.formatDateTime(dateTime); // "2024.03.15 14:30"
DateFormatter.formatTime12(dateTime); // "์คํ 2:30"
// ๊ธฐ๊ฐ
DateFormatter.formatRange(start, end); // "2024.03.15 ~ 2024.03.20"
๐ ๊ฐ์ธ์ ๋ณด ๋ง์คํน (PrivacyMasker) #
// ๋ฒ์ฉ ๋ง์คํน
PrivacyMasker.mask("ํ๊ธธ๋", start: 1, end: 2); // "ํ*๋"
PrivacyMasker.mask("01012345678", start: 3, end: 7); // "010****5678"
// ํ์
๋ณ ํธ์ ๋ฉ์๋
PrivacyMasker.name("ํ๊ธธ๋"); // "ํ*๋" (๊ธฐ๋ณธ)
PrivacyMasker.name("ํ๊ธธ๋", start: 0, end: 2); // "**๋" (์ปค์คํ
)
PrivacyMasker.email("test@gmail.com"); // "te**@gmail.com"
PrivacyMasker.phone("01012345678"); // "010-****-5678"
PrivacyMasker.rrn("901215-1234567"); // "901215-1******"
PrivacyMasker.account("12345678901234"); // "1234******1234"
PrivacyMasker.card("1234567890123456"); // "1234-****-****-3456"
๐ข ์ฌ์ ์๋ฒํธ ํฌ๋งทํฐ (BusinessFormatter) #
// ํฌ๋งทํ
BusinessFormatter.formatBrn("1234567890"); // "123-45-67890"
// ์ ํจ์ฑ ๊ฒ์ฌ (๊ตญ์ธ์ฒญ ๊ณต์ ์๊ณ ๋ฆฌ์ฆ)
BusinessFormatter.isValidBrn("1234567890"); // true/false
// ๋ฒ์ธ๋ฑ๋ก๋ฒํธ
BusinessFormatter.formatCrn("1234567890123"); // "123456-7890123"
BusinessFormatter.isValidCrn("1234567890123"); // true/false
๐ API Reference #
KrwFormatter #
format(int amount, {bool unit = true})- ๊ธฐ๋ณธ ๊ธ์ก ํฌ๋งทํtoKorean(int amount)- ํ๊ธ ๋จ์ ํ๊ธฐtoKoreanCompact(int amount)- ๊ฐ๋ตํ ํ๊ธ ๋จ์formatSigned(int amount, {bool unit = true})- ๋ถํธ ํฌํจparse(String amountStr)- ํ๊ธ ๊ธ์ก ํ์ฑ
PercentFormatter #
format(double rate, {int decimals = 2})- ๊ธฐ๋ณธ ํฌ๋งทํformatSigned(double rate, {int decimals = 2})- ๋ถํธ ํฌํจgetColor(double rate, {...})- ์์ ๋ฐํparse(String rateStr)- ํผ์ผํธ ํ์ฑ
PhoneFormatter #
format(String phone)- ์ ํ๋ฒํธ ํฌ๋งทํmask(String phone, {int? start, int? end})- ๋ง์คํนisValid(String phone)- ์ ํจ์ฑ ๊ฒ์ฌisMobile(String phone)- ํด๋ํฐ ํ์ธisLandline(String phone)- ์ผ๋ฐ์ ํ ํ์ธ
RelativeTime #
format(DateTime dateTime)- ๊ธฐ๋ณธ ์๋ ์๊ฐformatSmart(DateTime dateTime)- ์ค๋งํธ ํฌ๋งทformatShort(DateTime dateTime)- ์งง์ ํ์formatFuture(DateTime dateTime)- ๋ฏธ๋ ์๊ฐ
DateFormatter #
format(DateTime date)- ๊ธฐ๋ณธ ๋ ์ง ํฌ๋งทformatFull(DateTime date)- ์ ์ฒด ๋ ์งformatWithDay(DateTime date)- ์์ผ ํฌํจformatDateTime(DateTime dateTime)- ๋ ์ง+์๊ฐformatTime12(DateTime dateTime)- 12์๊ฐ์
PrivacyMasker #
mask(String value, {int? start, int? end, String maskChar = '*'})- ๋ฒ์ฉ ๋ง์คํนname(String name, {...})- ์ด๋ฆ ๋ง์คํนemail(String email, {...})- ์ด๋ฉ์ผ ๋ง์คํนphone(String phone, {...})- ์ ํ๋ฒํธ ๋ง์คํนrrn(String rrn, {...})- ์ฃผ๋ฏผ๋ฑ๋ก๋ฒํธ ๋ง์คํนaccount(String account, {...})- ๊ณ์ข๋ฒํธ ๋ง์คํนcard(String card, {...})- ์นด๋๋ฒํธ ๋ง์คํน
BusinessFormatter #
formatBrn(String brn)- ์ฌ์ ์๋ฑ๋ก๋ฒํธ ํฌ๋งทํisValidBrn(String brn)- ์ฌ์ ์๋ฑ๋ก๋ฒํธ ๊ฒ์ฆformatCrn(String crn)- ๋ฒ์ธ๋ฑ๋ก๋ฒํธ ํฌ๋งทํisValidCrn(String crn)- ๋ฒ์ธ๋ฑ๋ก๋ฒํธ ๊ฒ์ฆ
๐ค Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.
๐ License #
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments #
- Formatters are optimized for Korean financial and business environments
- Business registration number validation follows NTS (National Tax Service) standards