Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
RTL
Delphi
Arithmetic
ConvUtils
Date - Time
DateUtils
File Management
Format + Float
Input/Output
Math Unit
Memory, Pointer, Address
Null-terminated strings
Other Classes
Other RTL
Pascal Strings
Regular Expressions
RTL Exceptions
Text Files
Thread support
Typed/Untyped Files
WinAPI
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/RTL/Delphi/Format + Float
[ Add a report in this area ]
Report #:
101552
Status:
Closed
[REGRESSION in XE2] Format function doesn't handle #0 characters
Project:
Delphi
Build #:
16.0.4316.44803
Version:
16.2
Submitted By:
Stephen Millington
Report Type:
Basic functionality failure
Date Reported:
12/5/2011 4:07:09 AM
Severity:
Serious / Highly visible problem
Last Updated:
12/19/2012 8:01:04 PM
Platform:
All versions
Internal Tracking #:
289067
Resolution:
Fixed
(Resolution Comments)
Resolved in Build:
:
Update 4
Duplicate of:
None
Voting and Rating
Overall Rating:
No Ratings Yet
0.00 out of 5
Total Votes:
None
Description
After upgrading from Delphi 2007 to Delphi XE2 I have found that when using the Format function with %s then if the string contains #0 characters, only the characters up to the first #0 are returned. Delphi 2007 returned all the characters.
Added by Sysop
<<<<<<
ShowMessage(IntToStr(Length(str2)));
In Delphi 6, ... XE, it outputs 17.
But in Delphi XE2, it outputs 10.
Please see [Steps] for more details.
>>>>>>
Steps to Reproduce:
var
str, str2: string;
i: integer;
begin
i := 10;
str := 'hello' + #0 + ' world';
str2 := format('%d - %s', [i, str]);
ShowMessage(IntToStr(Length(str2)));
end;
In Delphi 2007/XE it outputs 17, but in Delphi XE2 it outputs 10.
Workarounds
instead of using the Format function do str2 := IntToStr(i) + ' - ' + str;
Attachment
None
Comments
Stephen Millington at 12/5/2011 8:31:49 AM
-
It is not the Length function that is at fault, it is the Format function. I just included the call to the Length function to demonstrate the problem but if you look at the local variables window in the IDE for str2 after putting a breakpoint after the Format line you can see it has been truncated at the #0.
Tomohiro Takahashi at 12/5/2011 5:16:32 PM
-
Thanks for the information.
I will check this issue with Delphi 6, 2007, 2009, 2010, XE, XE2...
Tomohiro Takahashi at 12/5/2011 5:51:36 PM
-
Delphi 6, ... XE return 17 correctly.
Tomohiro Takahashi at 1/4/2012 10:56:18 PM
-
We hope this issue will be fixed in next update release(e.g., Update 4).
Please stay tuned.
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us