Modify

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#237 closed Feature Request (Rejected)

FileSearchLine() and _ArraySum()

Reported by: Jayowee (jay_paans@… 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

Change History (3)

comment:1 Changed 17 years ago by TicketCleanup

  • Milestone Future Release deleted
  • Version 3.2.10.0 deleted

Automatic ticket cleanup.

comment:2 Changed 17 years ago by Valik

  • Resolution set to Rejected
  • Status changed from new to 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 Changed 17 years ago by Jayowee

Well excuse me...
You're right that I haven't included testing. I'm just bringing up ideas, thinking along, you-know.

Thanks alot.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.