相关疑难解决方法(0)

WideString与Delphi 2009中的String相同

我在2009年重新编译了一些在不同点使用宽带的应用程序.

在Delphi 2009 App中,Widestring与String相同吗?

delphi unicode delphi-2009

13
推荐指数
4
解决办法
5738
查看次数

最新的Delphi编译器版本和String类型兼容性

我正在尝试使一些String处理例程与最新的delphi版本兼容.我正在使用Delphi2005和2007,但我不完全确定它的兼容性.

以下是一些示例,它们是否与旧的和新的字符串类型兼容?(我将使用一个虚构的STRING_UNICODE指令).

  1. a类型定义:

    {$IFNDEF UNICODE_STRING}  
    TextBuffer = Array[0..13] Of Char;   
    {$ELSE}  
    TextBuffer = Array[0..13] Of WideChar;  
    {$ENDIF}
    
    Run Code Online (Sandbox Code Playgroud)

    无用与否?在Unicode字符串之前是Char类型(成为什么)WideChar,还是存在差异?

  2. 功能:

    Function RemoveBlanks(Text: String): String;  
    Var   
      i: integer;  
    Begin  
      result := '';  
      For i:= 0 To Length(Text) Do  
      Begin  
        {$IFNDEF UNICODE_STRING}   
        If Byte(Text[i]) < 21 Then Continue;   
        {$ELSE}  
        If Word(Text[i]) < 21 Then Continue;  
        {$ENDIF}  
        If Text[i] = ' ' Then Continue;    
        Result := Result + Text[i];  
      End;
    
    Run Code Online (Sandbox Code Playgroud)

    Word()的投射是否正常?

    这里也有' '问题.如何在Unicode版本中处理空间?我是否还应该使用该指令来区分' '和/ ' '或将' '自动处理为2字节的空白? …

delphi string unicode compatibility utf-8

1
推荐指数
1
解决办法
366
查看次数

标签 统计

delphi ×2

unicode ×2

compatibility ×1

delphi-2009 ×1

string ×1

utf-8 ×1