文档详情

CStringFormat()函数与格式输入与输出(国外英文资料).doc

发布:2017-06-09约1.64万字共23页下载文档
文本预览下载声明
CStringFormat()函数与格式输入与输出(国外英文资料) CString: : Format () function and Format input and output Format is a common, but seemingly annoying, method, and here is a complete picture of what it looks like: Formatting string forma ( % d , 12) means to have a formatted character (which I think is unchanged) The format specification is always starting with % characters, following is the following description of the format of different types of data: D outputs a decimal number O output unsigned octal number X output no hexadecimal number U output unsigned number C outputs a single character S outputs a string of characters F output real number (6 bits) E is the output of real Numbers in exponential form G chooses the format of the output width in the f and e format, and does not output 0 Ld input output long type data Lf input output double data M data output width is m N output decimal number is n A, string, First, the statement: The function Format (const Format: string; const Args: array of const) : string; The phrase ; In fact, the Format method has two forms, the other is three parameters, the main difference is that its thread-safe, But not much, so heres the first one: The function Format (const Format: string; const Args: array of const) : string; The phrase ; The Format parameter is a Format string that is used to Format the values in the Args. So what is Args? It is an array of variants that can have multiple parameters in it, and each parameter can be different. Example: Format ( my name is % 6s , wind); After return is My name is wind Now look at the details of the Format parameters: You can write the normal strings in Format, like my name is But some format command characters have special meaning, such as % 6s Format instructions have the following form: % [index :] [ ] [ ] [ ] It starts with % and ends with type, and type represents a specific type. Middle is used to The command character that formats the type type is optional. To see the type, the type can be the
显示全部
相似文档