1package stringhelper;
2
3#**************************************************************
4#
5#  Licensed to the Apache Software Foundation (ASF) under one
6#  or more contributor license agreements.  See the NOTICE file
7#  distributed with this work for additional information
8#  regarding copyright ownership.  The ASF licenses this file
9#  to you under the Apache License, Version 2.0 (the
10#  "License"); you may not use this file except in compliance
11#  with the License.  You may obtain a copy of the License at
12#
13#    http://www.apache.org/licenses/LICENSE-2.0
14#
15#  Unless required by applicable law or agreed to in writing,
16#  software distributed under the License is distributed on an
17#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18#  KIND, either express or implied.  See the License for the
19#  specific language governing permissions and limitations
20#  under the License.
21#
22#**************************************************************
23
24
25
26use strict;
27
28BEGIN {
29    use Exporter   ();
30    our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
31
32    $VERSION     = 1.00;
33    # if using RCS/CVS, this may be preferred
34    $VERSION = do { my @r = (q$Revision: 1.2 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
35    @ISA         = qw(Exporter);
36    @EXPORT      = qw(&endswith &startswith);
37    %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],
38    # your exported package globals go here,
39    # as well as any optionally exported functions
40    @EXPORT_OK   = ( ); # qw($Var1 %Hashit &func3);
41}
42
43# string helper like java endsWith
44sub endswith($$)
45{
46    my $string = shift;
47    my $search = shift;
48    if ( $string =~ /${search}$/ )
49    {
50        return 1;
51    }
52    return 0;
53}
54sub startswith($$)
55{
56    my $string = shift;
57    my $search = shift;
58    if ( $string =~ /^${search}/ )
59    {
60        return 1;
61    }
62    return 0;
63}
64
651;
66