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/Regular Expressions
[ Add a report in this area ]
Report #:
104561
Status:
Closed
InitialCaps() in System.RegularExpressionsCore does not work
Project:
Delphi
Build #:
16.0.4429.46931
Version:
16.4
Submitted By:
Jan Goyvaerts
Report Type:
Basic functionality failure
Date Reported:
4/1/2012 11:09:40 PM
Severity:
Commonly encountered problem
Last Updated:
4/23/2013 8:14:22 AM
Platform:
All platforms
Internal Tracking #:
26974
Resolution:
Fixed
(Resolution Comments)
Resolved in Build:
:
XE4
Duplicate of:
None
Voting and Rating
Overall Rating:
No Ratings Yet
0.00 out of 5
Total Votes:
None
Description
The InitialCaps function in the implementation section of the System.RegularExpressionsCore unit is supposed to capitalize the first letter of each word in S, but it only capitalizes the first character in S.
To fix this, this line:
Result[1] := UpperCase(S[1], loUserLocale)[1];
must be changed into:
Result[I] := UpperCase(Result[I], loUserLocale)[1];
Steps to Reproduce:
By USc:
- dcc QC104561.dpr
- execute QC104561
expected: output is PASS
actual: output is
FAIL #4
Expected: "Hello World"
Actual: "Hello world"
Different chars: " ! "
FAIL
program QC104561;
{$APPTYPE CONSOLE}
uses
System.RegularExpressions;
var
Counter: Integer = 0;
procedure EvalStrings(const Actual, AExpected: string; ATest: Integer);
var
I, M: Integer;
S: string;
begin
if Actual = AExpected then
Inc(Counter)
else
begin
WriteLn('FAIL #', ATest);
WriteLn(' Expected: "', AExpected, '"');
WriteLn(' Actual: "', Actual, '"');
M := Length(Actual);
if Length(AExpected) < M then
M := Length(AExpected);
S := StringOfChar(' ', M);
for I := 1 to M do
if Actual[I] <> AExpected[I] then
S[I] := '!';
WriteLn(' Different chars: "', S, '"');
end;
end;
begin
EvalStrings(TRegEx.Replace('HeLlO WoRlD', '.+', '\u0'), 'HELLO WORLD', 1);
EvalStrings(TRegEx.Replace('HeLlO WoRlD', '.+', '\l0'), 'hello world', 2);
EvalStrings(TRegEx.Replace('HeLlO WoRlD', '.+', '\f0'), 'Hello world', 3);
EvalStrings(TRegEx.Replace('HeLlO WoRlD', '.+', '\i0'), 'Hello World', 4);
if Counter = 4 then
WriteLn('PASS')
else
WriteLn('FAIL');
end.
Original steps:
This code:
WriteLn(TRegEx.Replace('HeLlO WoRlD', '.+', '\u0'));
WriteLn(TRegEx.Replace('HeLlO WoRlD', '.+', '\l0'));
WriteLn(TRegEx.Replace('HeLlO WoRlD', '.+', '\f0'));
WriteLn(TRegEx.Replace('HeLlO WoRlD', '.+', '\i0'));
is supposed to print:
HELLO WORLD
hello world
Hello world
Hello World
but it actually prints:
HELLO WORLD
hello world
Hello world
Hello world
The 3rd and 4th lines are the same, but they should be different.
Workarounds
None
Attachment
None
Comments
Tomohiro Takahashi at 4/3/2012 7:19:37 PM
-
This report was opened with valid Internal Tracking Number.
Thanks.
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