Note that there are some explanatory texts on larger screens.

plurals
  1. PONewest Delphi compiler versions and String type compatibilty
    primarykey
    data
    text
    <p>I'm trying to make some String processing routines compatible with newest delphi version. I'm using Delphi2005 and 2007 but I'm not totally sure of the compatibility.</p> <p>Here are a few samples, are they compatible with both the old and the new string type ? ( I'll use an imaginary STRING_UNICODE directive ).</p> <ol> <li><p>a Type definition:</p> <pre><code>{$IFNDEF UNICODE_STRING} TextBuffer = Array[0..13] Of Char; {$ELSE} TextBuffer = Array[0..13] Of WideChar; {$ENDIF} </code></pre> <p>Useless or not? Is the Char type (becomes what was) a WideChar before the Unicode String, or is there still a difference?</p></li> <li><p>a Function:</p> <pre><code>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]) &lt; 21 Then Continue; {$ELSE} If Word(Text[i]) &lt; 21 Then Continue; {$ENDIF} If Text[i] = ' ' Then Continue; Result := Result + Text[i]; End; </code></pre> <p>Is the Word() casting OK?</p> <p>Here there is also the <code>' '</code> problem. How is the space handled in Unicode version? Should I also use the directive to differentiate <code>' '</code> and <code>' '</code> or will the <code>' '</code> be automatically handled as a 2-byte blank?</p></li> <li><p>a line jump:</p> <pre><code>NewLineBegin := CanReadText( aPTextBuffer, #13#10 ); </code></pre> <p>How is the the second argument (<code>#13#10</code>) interpreted in the Unicode version? Is it compatible? Will it be translated to the byte block <code>00130010</code>? If not, then should the directive be used instead with the constant <code>#0013#0010</code>?</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload