本文共 836 字,大约阅读时间需要 2 分钟。
在编程过程中,string和ANSIString之间的转换是常见操作。本文将详细介绍几种常见的转换方法。
ANSIString()类型的强制转换函数,将string转换为ANSIString。这种方法无需警告。string()类型的强制转换函数,将ANSIString转换为string。这种方法无需警告。bytesof(str)函数,将string转换为ANSI编码的Tbytes。widebytesof(str)函数,将string转换为UNICODE编码的Tbytes。bytesof(str)函数,将ANSIString转换为ANSI编码的Tbytes。widebytesof(string(str))函数,将ANSIString转换为UNICODE编码的Tbytes。stringof(bytes)函数,将ANSI编码的Tbytes转换为string。widestringof(bytes)函数,将UNICODE编码的Tbytes转换为string。StrPas函数,将PChar类型转换为ANSIString。StrPas(PChar): AnsiString;转载地址:http://dqqfk.baihongyu.com/