View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002097 | JEDI VCL | 00 JVCL Components | public | 2004-08-26 05:28 | 2004-08-26 11:51 |
| Reporter | Dierk | Assigned To | |||
| Priority | normal | Severity | trivial | Reproducibility | always |
| Status | closed | Resolution | open | ||
| Product Version | |||||
| Target Version | Fixed in Version | ||||
| Summary | 0002097: function WordCount in Unit JvJCLUtils has no result! | ||||
| Description | function 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 | ||||
| Tags | No tags attached. | ||||
|
|
> 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? |
|
|
Uhhh. Sorry my mistake! I didn`t see this : if I <= SLen then Inc(Result); |