line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Spreadsheet::Engine::Function::FIND; |
2
|
|
|
|
|
|
|
|
3
|
28
|
|
|
28
|
|
153
|
use strict; |
|
28
|
|
|
|
|
57
|
|
|
28
|
|
|
|
|
1130
|
|
4
|
28
|
|
|
28
|
|
145
|
use warnings; |
|
28
|
|
|
|
|
61
|
|
|
28
|
|
|
|
|
705
|
|
5
|
|
|
|
|
|
|
|
6
|
28
|
|
|
28
|
|
147
|
use base 'Spreadsheet::Engine::Fn::text'; |
|
28
|
|
|
|
|
53
|
|
|
28
|
|
|
|
|
14235
|
|
7
|
|
|
|
|
|
|
|
8
|
420
|
|
|
420
|
1
|
1175
|
sub argument_count { -2 => 3 } |
9
|
|
|
|
|
|
|
|
10
|
420
|
|
|
420
|
1
|
1557
|
sub signature { 't', 't', 'n' } |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub calculate { |
13
|
420
|
|
|
420
|
1
|
16976
|
my ($self, $want, $string, $offset) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# TODO allow signature to define defaults & custom error messages |
16
|
420
|
100
|
|
|
|
1311
|
$offset = 1 unless defined $offset; |
17
|
420
|
100
|
|
|
|
1535
|
die Spreadsheet::Engine::Error->val('Start is before string') |
18
|
|
|
|
|
|
|
if $offset < 1; |
19
|
|
|
|
|
|
|
|
20
|
321
|
|
|
|
|
1456
|
my $result = index $string, $want, $offset - 1; |
21
|
321
|
100
|
|
|
|
1059
|
die Spreadsheet::Engine::Error->val('Not found') unless $result >= 0; |
22
|
267
|
|
|
|
|
1362
|
return $result + 1; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
420
|
|
|
420
|
1
|
1480
|
sub result_type { 'n' } |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |