jl165 merging heads
[LibreOffice.git] / testgraphical / source / stringhelper.pm
blobe7d19256bf1b40d86103338d968d33e2a2fd0a6e
1 package stringhelper;
3 #*************************************************************************
5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 # Copyright 2000, 2010 Oracle and/or its affiliates.
9 # OpenOffice.org - a multi-platform office productivity suite
11 # This file is part of OpenOffice.org.
13 # OpenOffice.org is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU Lesser General Public License version 3
15 # only, as published by the Free Software Foundation.
17 # OpenOffice.org is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU Lesser General Public License version 3 for more details
21 # (a copy is included in the LICENSE file that accompanied this code).
23 # You should have received a copy of the GNU Lesser General Public License
24 # version 3 along with OpenOffice.org. If not, see
25 # <http://www.openoffice.org/license.html>
26 # for a copy of the LGPLv3 License.
28 #*************************************************************************
30 use strict;
32 BEGIN {
33 use Exporter ();
34 our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
36 $VERSION = 1.00;
37 # if using RCS/CVS, this may be preferred
38 $VERSION = do { my @r = (q$Revision: 1.2 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
39 @ISA = qw(Exporter);
40 @EXPORT = qw(&endswith &startswith);
41 %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
42 # your exported package globals go here,
43 # as well as any optionally exported functions
44 @EXPORT_OK = ( ); # qw($Var1 %Hashit &func3);
47 # string helper like java endsWith
48 sub endswith($$)
50 my $string = shift;
51 my $search = shift;
52 if ( $string =~ /${search}$/ )
54 return 1;
56 return 0;
58 sub startswith($$)
60 my $string = shift;
61 my $search = shift;
62 if ( $string =~ /^${search}/ )
64 return 1;
66 return 0;