728x90
반응형
TFormatSettings를 사용한 지역화된 숫자/날짜 포맷 처리
델파이에서 숫자나 날짜 형식을 지역 설정에 따라
다르게 출력해야 할 경우 TFormatSettings를 사용하면 유용합니다.
특히 다국어 지원이나 사용자 맞춤 포맷이 필요할 때 매우 효과적입니다.
uses
System.SysUtils;
procedure ShowLocalizedDateAndNumber;
var
FS: TFormatSettings;
FormattedDate, FormattedNumber: string;
begin
FS := TFormatSettings.Create('fr-FR'); // 프랑스 지역 설정
FormattedDate := FormatDateTime('dd mmmm yyyy', Date, FS);
FormattedNumber := FormatFloat('#,##0.00', 1234567.89, FS);
ShowMessage('날짜 (프랑스): ' + FormattedDate); // 예: "07 avril 2025"
ShowMessage('숫자 (프랑스): ' + FormattedNumber); // 예: "1 234 567,89"
end;
● TFormatSettings.Create('언어코드')로 국가별 설정 적용 가능
● 날짜, 시간, 소수점, 천 단위 구분자 등 지역 맞춤 포맷 적용
● FormatDateTime, FormatFloat, Format 등과 함께 사용

728x90
반응형
'Delphi > 프로시저-함수' 카테고리의 다른 글
해당날짜 몇 주차인지 알아내기 (0) | 2024.07.05 |
---|---|
숫자 정수 반올림(어셈블러 Assembler) (0) | 2024.05.28 |
주민등록번호 성인인증 (0) | 2024.05.14 |
첫번째 영문을 대문자 변경 (0) | 2024.05.13 |
한글 자음 모음 분리 (0) | 2024.05.10 |
댓글