View Issue Details

IDProjectCategoryView StatusLast Update
0002097JEDI VCL00 JVCL Componentspublic2004-08-26 11:51
ReporterDierkAssigned To 
PrioritynormalSeveritytrivialReproducibilityalways
Status closedResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0002097: function WordCount in Unit JvJCLUtils has no result!
Descriptionfunction WordCount(const S: string; const WordDelims: TSysCharSet): Integer;
var
  SLen, I: Cardinal;
begin
  Result := 0;
  I := 1;
  SLen := Length(S);
  while I <= SLen do
  begin
    while (I <= SLen) and (S[I] in WordDelims) do
      Inc(I);
    if I <= SLen then
      Inc(Result);
    while (I <= SLen) and not (S[I] in WordDelims) do
      Inc(I);
  end;
  Result:=I; '<--- Insert this line
end;

Regards
Dierk
TagsNo tags attached.

Activities

AHUser

2004-08-26 07:01

developer   ~0005100

> Result:=I; '<--- Insert this line
I don't think so. If you do this I could simplyfy the whole function to "Result := Length(S);"

Result has a value. In the first line (after "begin") it is set to zero. And here
> if I <= SLen then
> Inc(Result);
it is increased.

Why do you think it has no return value?

anonymous

2004-08-26 07:09

viewer   ~0005103

Uhhh. Sorry my mistake!
I didn`t see this :

if I <= SLen then
   Inc(Result);

Issue History

Date Modified Username Field Change
2004-08-26 05:28 Dierk New Issue
2004-08-26 07:01 AHUser Note Added: 0005100
2004-08-26 07:01 AHUser Status new => feedback
2004-08-26 07:09 anonymous Note Added: 0005103
2004-08-26 11:51 AHUser Status feedback => closed