#237 closed Feature Request (Rejected)
FileSearchLine() and _ArraySum()
| Reported by: | Owned by: | ||
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | Severity: | None | |
| Keywords: | FileSearchLine _ArraySum | Cc: |
Description
I have two ideas:
1) FileSearchLine("filename", "searchstring") which returns the (1-based) linenumber of the first occurense of the searchstring.
Possible script:
For $line= 1 To _FileCountLines($file) If FileReadLine($file, $line) = "searchstring" Then Return $line Next
Maybe a parameter could make this function return an array with all occurences (if more than one)...
2) _ArraySum($array) which simply adds up all of the arrays elements. I think a condition must be that all elements are numbers because you can't really add up strings.
Possible script:
Dim $sum=0 For $n= 1 To UBound($array) $sum += $array[$n] Next Return $sum
I hope these are two ideas you guys can use.
Jay
Attachments (0)
Change History (3)
comment:1 by , 18 years ago
| Milestone: | Future Release |
|---|---|
| Version: | 3.2.10.0 |
comment:2 by , 18 years ago
| Resolution: | → Rejected |
|---|---|
| Status: | new → closed |
That's a terribly inefficient and restrictive way to write a FileSearchLine() function. Using regular expressions, positions and an efficient way of counting lines would be far superior I think.
In either case, both functions are trivial to write. You might have had a better chance if you had done a proper UDF submission.
Closing as Rejected.
comment:3 by , 18 years ago
Well excuse me...
You're right that I haven't included testing. I'm just bringing up ideas, thinking along, you-know.
Thanks alot.

Automatic ticket cleanup.