티스토리 뷰

Delphi

function Format(const Format: string; const Args: array of const): string;

function Format(const Format: string; const Args: array of const; const AFormatSettings: TFormatSettings): string;

C++

extern PACKAGE System::UnicodeString __fastcall Format(const System::UnicodeString Format, System::TVarRec const *Args, const int Args_Size)/* overload */;

Properties

Type

Visibility

Source

Unit

Parent

function

public

System.SysUtils.pas

System.SysUtils.hpp

System.SysUtils

System.SysUtils

Description

Returns a formatted string assembled from a format string and an array of arguments.

The Format function formats the series of arguments in an open (untyped) array.

Format is the format string.

For information on format strings, see Format Strings, described in this topic.

Args is an array of arguments to apply to the format specifiers in Format.

For C++, Args_Size specifies the index of the last element of Args (one less than the number of elements).

Format returns the results of applying the arguments in Args to the format string Format.

 

Format 문자열과 인수 배열에서 조합된 형식화된 문자열을 반환합니다.

Format 함수는 열린 (형식화되지 않은) 배열에서 일련의 인수를 형식화합니다.

Format 은 형식 문자열입니다.

Format 문자열에 대한 자세한 내용은 이 항목에서 설명하는 서식 문자열을 참조하십시오.

ArgsFormat의 형식 지정자에 적용할 인수 배열입니다.

C ++의 경우 Args_SizeArgs의 마지막 요소의 인덱스(요소 개수보다 하나적은)를 지정합니다.

FormatArgs의 인수를 Format 문자열 형식에 적용한 결과를 반환합니다.

 

Two syntax forms are given for Format.

The first form of Format is not thread-safe, because it uses localization information contained in global variables.

The second form of Format, which is thread-safe, refers to localization information contained in the FormatSettings parameter.

Before calling the thread-safe form of Format, you must populate FormatSettings with localization information.

To populate FormatSettings with a set of default locale values, call GetLocaleFormatSettings.

 

Format에는 두 가지 구문 형식이 있습니다.

Format의 첫 번째 형식은 전역 변수에 포함된 지역화 정보를 사용하므로 스레드로부터 안전하지 않습니다.

Format의 두 번째 형식(스레드로부터 안전함)FormatSettings 매개 변수에 포함된 지역화 정보를 참조합니다.

thread-safe 형식의 Format을 호출하기 전에 FormatSettings에 지역화 정보를 채워야 합니다.

FormatSettings에 기본 지역 값을 채우려면 GetLocaleFormatSettings를 호출합니다.

 

Format Strings

Format strings specify required formats to general-purpose formatting routines.

Format strings passed to the string formatting routines contain two types of objects--literal characters and format specifiers.

Literal characters are copied word for word to the resulting string.

Format specifiers fetch arguments from the argument list and apply the formatting to them.

Format specifiers have the following form:

"%" [index ":"] ["-"] [width] ["." prec] type

 

Format 문자열은 범용 서식 지정 루틴에 필요한 서식을 지정합니다.

문자열 형식 지정 루틴에 전달된 Format 문자열에는 리터럴 문자format 지정자의 두 가지 유형의 오브젝트가 포함됩니다.

리터럴 문자는 결과 문자열에 word라는 단어로 복사됩니다.

Format 지시자는 인수 목록에서 인수를 가져와서 형식 지정을 적용합니다.

Format 지정자는 다음 형식을 갖습니다.

 

A format specifier begins with a % character. After the percent sign come the following elements, in this order:

1.     An optional argument zero-offset index specifier (that is, the first item has index 0), [index ":"].

2.     An optional left justification indicator, ["-"].

3.     An optional width specifier, [width].

4.     An optional precision specifier, ["." prec].

5.     The conversion type character, type.

 

format 지정자% 문자로 시작합니다. 백분율 기호 뒤에 다음 요소가 이 순서대로 옵니다.

1.     선택적인 인수 제로 - 오프 인덱스 지정자 (, 첫 번째 항목의 인덱스가 0), [인덱스 ":"].

2.     선택적인 왼쪽 맞춤 표시기, ["-"].

3.     선택적인 폭 지정자, [width].

4.     선택적인 정밀도 지정자, [ "." prec].

5.     변환 유형 문자, 유형.

 

The following table summarizes the possible values for type:

다음 표에서는 가능한 값 유형을 요약합니다.

Value

Meaning

d

Decimal. The argument must be an integer value. The value is converted to a string of decimal digits.

If the format string contains a precision specifier,

it indicates that the resulting string must contain at least the specified number of digits.

if the value has less digits, the resulting string is left-padded with zeros.

10진수. 인수는 정수 값이어야 합니다. 값은 10 진수 문자열로 변환됩니다.

format 문자열에 정밀도 지정자가 포함되는 경우,

결과 문자열이 적어도 지정된 자릿수(0~9)를 포함해야 함을 나타냅니다.

값의 자릿수가 작으면 결과 문자열에 0이 왼쪽으로 채워집니다.

u

Unsigned decimal. Similar to d, but no sign is output.

부호 없는 10진수. d와 유사하지만 부호가 출력되지 않습니다.

e

Scientific. The argument must be a floating-point value.

The value is converted to a string of the form "-d.ddd...E+ddd".

The resulting string starts with a minus sign if the number is negative.

One digit always precedes the decimal point.

The total number of digits in the resulting string (including the one before the decimal point) is given by the precision specifier in the format string.

A default precision of 15 is assumed if no precision specifier is present.

The "E" exponent character in the resulting string is always followed by a plus or minus sign and at least three digits.

과학적인. 인수는 부동 소수점 값이어야 합니다.

값은 "-d.ddd ... E+ddd" 형식의 문자열로 변환됩니다.

결과 문자열은 숫자가 음수이면 빼기 기호로 시작합니다.

한 자리는 항상 소수점 앞에옵니다.

결과 문자열의 전체 자릿수 (소수점 이전에 하나 포함)format 문자열의 정밀도 지정자에 의해 지정됩니다.

정밀도 지정자가 없는 경우 기본 정밀도는 15로 간주됩니다.

결과 문자열의 "E" 지수 문자 뒤에는 항상 플러스 또는 마이너스 기호와 최소 세 자리가 옵니다.

f

Fixed. The argument must be a floating-point value.

The value is converted to a string of the form "-ddd.ddd...".

The resulting string starts with a minus sign if the number is negative.

The number of digits after the decimal point is given by the precision specifier in the format string—a default of 2 decimal digits is assumed if no precision specifier is present.

결정된. 인수는 부동 소수점 값이어야 합니다.

값은 "-ddd.ddd ..."형식의 문자열로 변환됩니다.

결과 문자열은 숫자가 음수이면 빼기 기호로 시작합니다.

소수점 뒤의 자릿수는 문자열 형식의 정밀도 지정자가 지정합니다. 정밀도 지정자가 없으면 기본값은 2 자리 10진수로 간주됩니다.

g

General. The argument must be a floating-point value.

The value is converted to the shortest possible decimal string using fixed or scientific format.

The number of significant digits in the resulting string is given by the precision specifier in the format string

A default precision of 15 is assumed if no precision specifier is present.

Trailing zeros are removed from the resulting string, and a decimal point appears only if necessary.

The resulting string uses the fixed-point format if the number of digits to the left of the decimal point in the value is less than or equal to the specified precision, and if the value is greater than or equal to 0.00001.

Otherwise the resulting string uses scientific format.

일반. 인수는 부동 소수점 값이어야 합니다.

값은 고정 또는 과학적인 형식을 사용하여 가능한 가장 짧은 10 진수 문자열로 변환됩니다.

결과 문자열의 유효 자릿수는 format 문자열의 정밀도 지정자로 지정됩니다.

정밀도 지정자가 없는 경우 기본 정밀도는 15로 간주됩니다.

끝부분 0은 결과 문자열에서 제거되고 소수점은 필요한 경우에만 나타납니다.

결과 문자열은 값의 소수점 왼쪽에 있는 자릿수가 지정된 정밀도보다 작거나 같고 값이 0.00001보다 크거나 같은 경우 고정 소수점 형식을 사용합니다.

그렇지 않으면 결과 문자열이 과학적인 형식을 사용합니다.

n

Number. The argument must be a floating-point value.

The value is converted to a string of the form "-d,ddd,ddd.ddd...".

The n format corresponds to the f format, except that the resulting string contains thousand separators.

번호. 인수는 부동 소수점 값이어야 합니다.

값은 "-d, ddd, ddd.ddd ..."형식의 문자열로 변환됩니다.

n 형식은 f 형식에 해당합니다. , 결과 문자열에는 천 단위 구분 기호가 포함됩니다.

m

Money. The argument must be a floating-point value.

The value is converted to a string that represents a currency amount.

The conversion is controlled by the CurrencyString, CurrencyFormat, NegCurrFormat, ThousandSeparator, DecimalSeparator, and CurrencyDecimals global variables or their equivalent in a TFormatSettings data structure.

If the format string contains a precision specifier,

It overrides the value given by the CurrencyDecimals global variable or its TFormatSettings equivalent.

. 인수는 부동 소수점 값이어야 합니다.

값은 통화 금액을 나타내는 문자열로 변환됩니다.

변환은 TFormatSettings 데이터 구조에서 CurrencyString, CurrencyFormat, NegCurrFormat, ThousandSeparator, DecimalSeparatorCurrencyDecimals 전역 변수 또는 이와 동등한 변수로 제어됩니다.

format 문자열에 정밀도 지정자가 포함되는 경우,

CurrencyDecimals 전역 변수 또는 이에 상응하는 TFormatSettings 변수에 의해 주어진 값을 겹쳐 씁니다.

p

Pointer. The argument must be a pointer value.

The value is converted to an 8-character string that represents the pointer's value in hexadecimal.

포인터. 인수는 포인터 값이어야 합니다.

값은 포인터의 값을 16 진수로 나타내는 8 문자의 문자열로 변환됩니다.

s

String. The argument must be a character, a string, or a PChar value.

The string or character is inserted in place of the format specifier.

The precision specifier, if present in the format string, specifies the maximum length of the resulting string.

If the argument is a string that is longer than this maximum, the string is truncated.

문자열. 인수는 문자, 문자열 또는 PChar 값이어야 합니다.

문자열 또는 문자가 format 지정자 대신 삽입됩니다.

형식 지정자에 존재하는 경우 정밀도 지정자는 결과 문자열의 최대 길이를 지정합니다.

인수가 이 최대 길이보다 긴 문자열이면 문자열이 잘립니다.

x

Hexadecimal. The argument must be an integer value.

The value is converted to a string of hexadecimal digits.

If the format string contains a precision specifier,

It indicates that the resulting string must contain at least the specified number of digits.

If the value has fewer digits, the resulting string is left-padded with zeros.

16 진수. 인수는 정수 값이어야 합니다.

값은 16 진수 자릿수의 문자열로 변환됩니다.

format 문자열에 정밀도 지정자가 포함되는 경우,

결과 문자열이 적어도 지정된 자릿수를 포함해야 함을 나타냅니다.

값의 자릿수가 적은 경우 결과 문자열에 0이 왼쪽으로 채워집니다.

Conversion characters may be specified in uppercase as well as in lowercase; both produce the same results.

To display the character % (that is, to display a literal %, not to begin a format specifier), use the sequence %%. Example:

Writeln(Format('%d%%', [100])); // displays '100%'

For all floating-point formats, the actual characters used as decimal and thousand separators are obtained from the DecimalSeparator and ThousandSeparator global variables or their TFormatSettings equivalent.

 

변환 문자는 대문자 및 소문자로 지정할 수 있습니다. 둘 다 동일한 결과를 산출합니다.

문자 %를 표시하려면 (, format 지정자로 시작하지 말고 리터럴 %를 표시하려면) 시퀀스 %%를 사용하십시오. :

Writeln(Format('%d%%', [100])); // displays '100%'

모든 부동 소수점 형식의 경우 DecimalSeparator ThousandSeparator 전역 변수 또는 이와 동등한 TFormatSettings 에서 10진수와 천 단위 구분 기호로 사용된 실제 문자를 가져옵니다.

 

Index, width, and precision specifiers can be specified directly, using a decimal digit string (for example "%10d"), or indirectly, using an asterisk character (for example "%*.*f").

When using an asterisk, the next argument in the argument list becomes the value that is actually used.

Note that width is an integer value, while precision is an unsigned integer value.

For example,

Format ('%*.*f', [8, 2, 123.456]);

is equivalent to:

Format ('%8.2f', [123.456]);

Similarly, in C++:

TVarRec args[3] = {8,2,123.456};
Format ("%*.*f", args, 2);

is equivalent to:

TVarRec args[1] = {123.456};
Format ("%8.2f", args, 0);

 

10 진수 문자열 ( : "% 10d")을 사용하거나 간접적으로 별표 문자 ( : "% *. * f")를 사용하여 인덱스, 너비 및 정밀도 지정자는 직접 지정할 수 있습니다.

별표를 사용할 때 인수 목록의 다음 인수는 실제로 사용되는 값이 됩니다.

참고: width는 정수 값이고 precision은 부호 없는 정수 값입니다.

예를 들어,

Format ('%*.*f', [8, 2, 123.456]);

다음과 같습니다.

Format ('%8.2f', [123.456]);

마찬가지로, C ++에서 :

TVarRec args[3] = {8,2,123.456};
Format ("%*.*f", args, 2);

다음과 같습니다.

TVarRec args[1] = {123.456};
Format ("%8.2f", args, 0);

 

A width specifier sets the minimum field width for a conversion.

If the resulting string is shorter than the minimum field width, it is padded with blanks to increase the field width.

The default is to right-justify the result by adding blanks in front of the value, but if the format specifier contains a left-justification indicator (an "-" en dash character preceding the width specifier), the result is left-justified by adding blanks after the value.

 

폭 지정자는 변환의 최소 필드 너비를 설정합니다.

결과 문자열이 최소 필드 너비보다 짧으면, 공백으로 채워져 필드 너비를 늘립니다.

기본값은 값 앞에 공백을 추가하여 결과의 오른쪽 정렬을 지정하지만, format 지정자가 왼쪽 정렬 표시기 (너비 지정자 앞에 "-" 대시 문자)를 포함하면 결과는 갑 뒤에 공백을 추가하여 왼쪽 정렬이 됩니다.

 

An index specifier sets the current argument list index to the specified value.

The index of the first argument in the argument list is 0.

Using index specifiers, it is possible to format the same argument multiple times.

For example, "Format('%d %d %0:d %1:d', [10, 20])" produces the string '10 20 10 20'.

Note: Setting the index specifier affects all subsequent formatting.

That is, Format('%d %d %d %0:d %d', [1, 2, 3, 4]) returns '1 2 3 1 2', not '1 2 3 1 4'.

To get the latter result, you must use Format('%d %d %d %0:d %3:d', [1, 2, 3, 4]).

 

인덱스 지정자는 현재 인수 목록 인덱스를 지정된 값으로 설정합니다.

인수 목록에서 첫 번째 인수의 인덱스는 0입니다.

인덱스 지정자를 사용하면, 동일한 인수를 여러 번 형식화 할 수 있습니다.

예를 들어 "Format('%d %d %0:d %1:d', [10, 20])"은 문자열 '10 20 10 20 '을 생성합니다.

참고: 인덱스 지정자를 설정하면 모든 후속 서식에 영향을 줍니다.

, Format('%d %d %d %0:d %d', [1, 2, 3, 4]) '1 2 3 1 4'가 아니라 '1 2 3 1 2'를 반환합니다.

후자의 결과를 얻으려면 Format('%d %d %d %0:d %3:d', [1, 2, 3, 4])을 사용해야 합니다.

 

assembled 미국·영국 [əsémbld] 

모인, 집합된, 결집한

assemble 미국·영국 [ə|sembl] 

1. 모이다, 모으다, 집합시키다
2.
조립하다

describe 미국·영국 [dɪ|skraɪb] 

1. (~이 어떠한지를) 말하다, 묘사하다
2. (
움직임으로 특정한 형태를) 만들다

given 미국·영국 [|gɪvn] 

1. (이미) 정해진  2. 특정한  3. …을 고려해 볼 때

populate 미국식 [|pɑ:pjuleɪt] 

(프로그래밍) 데이터로 채우다.

1. (어떤 지역의 주민으로) 살다, 거주하다
2. (
어떤 지역으로 사람・동물들을) 이주시키다
3. (
서류에 데이터를) 덧붙이다

fetch 미국·영국 [fetʃ

1. (어디를 가서) 가지고 오다
2. (
특정 가격에) 팔리다

justification 미국·영국 [|dƷʌstɪfɪ|keɪʃn]

타당한 이유

precision 미국·영국 [prɪ|sɪƷn] 

정확(); 정밀(); 신중함

summarize 미국·영국 [|sʌməraɪz] 

요약하다

least 미국·영국 [li:st] 

1. (크기・양・정도 등이) 가장 적은; 최소()
2.
가장 덜, 최소로

padded 

1. (문장 따위가) 불필요하게 장황한.
2.
속을 채워 넣은; 푹신한(cushiony).
3.
부풀린, 분식(粉飾).

similar 미국·영국 [|sɪmələ(r)] 

비슷한, 유사한, 닮은

precede 미국·영국 [prɪ|si:d] 

1. …에 앞서다  2. … 앞에 가다

present 미국식 형용사 [|preznt] 

1. 현재의, 현 …
2.
있는, 참석한
3.
있는, 존재하는

assumed 미국식 [ə|su:md] 

(사실로 또는 존재하는 것으로) 추정되는

exponent 미국식 [ɪk|spoʊnənt] 

1. (사상・학설 등의) 주창자
2. (
특정 기예를 지닌) 예능인
3.
지수

significant 미국·영국 [sɪg|nɪfɪkənt] 

1. (영향을 주거나 두드러질 정도로) 중요한
2.
특별한 의미가 있는, 중요한
3. (
은밀하게) 의미심장한

currency 미국식 [|k3:rənsi] 

1. 통화  2. 통용

amount 미국·영국 [əmáunt] 

1. 총액, 총계; (대부금의) 원리 합계(total) ((of))
2.
(quantity), 액수(sum)
3.
요지(substance)

equivalent 미국·영국 [ɪ|kwɪvələnt] 

1. (가치・의미・중요도 등이) 동등한
2. (
…에) 상당하는 것, 등가물

truncated 미국·영국 [trʌ́ŋkeitid] 

1. (줄기·몸통 등의) 끝을 잘라버린; 끝을 자른
2. <
문장 등이> 몹시 생략된, 불완전한, <시구가> 결절(缺節)
3. (
도형·입체의) 정점을 평면으로 자른, 절두(切頭)

fewer 미국·영국 [fjú:ər] 

1. 보다 소수의
2.
보다 소수의 사람들

few (fewer) 미국·영국 [fju:] 

1. (수가) 많지 않은(복수 명사・동사와 함께 쓰임)
2. (
수가) 약간의(복수 명사・동사와 함께 쓰임)
3.
소수, 적은 수

produce 동사 [prə|du:s] 명사 [|prɑ:du:s;|proʊdu:s] 

1. (상품을 특히 대량으로) 생산하다
2. (
농작물 등을) 생산하다; (자식・새끼를) 낳다
3. (
특히 필요한 기술을 들여) 만들어 내다

obtain 미국·영국 [əb|teɪn] 

1. (특히 노력 끝에) 얻다
2.
존재하다

indirectly

간접적으로; 에둘러서, 넌지시; 부차적으로.

affect (affects) 미국·영국 [ə|fekt] 

1. 영향을 미치다
2. (
사람이나 신체 부위에) 발생하다; 병이 나게 하다
3. (
강한 정서적) 충격을 주다, 깊은 슬픔을 유발하다

subsequent 미국·영국 [|sʌbsɪkwənt] 

그 다음의, 차후의

 

출처: http://docwiki.embarcadero.com/Libraries/XE2/en/System.SysUtils.Format

'프로그래밍 언어 > Delphi' 카테고리의 다른 글

[Reference] System.RunError  (0) 2017.02.22
[Reference] System.Seek  (0) 2017.02.21
[Reference] Vcl.Dialogs.ShowMessagePos  (0) 2017.02.19
[Reference] Vcl.Dialogs.MessageDlg  (0) 2017.02.18
[Reference] System.High  (0) 2017.02.17
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/06   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
글 보관함