Subversion Repositories camp_sysinfo_client_3

Rev

Rev 116 | Rev 152 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 116 Rev 117
Line 17... Line 17...
17
#           chomps the string (removes trailing newlines)
17
#           chomps the string (removes trailing newlines)
18
#           removes all text BEFORE the delimiter, the delimiter, and any whitespace
18
#           removes all text BEFORE the delimiter, the delimiter, and any whitespace
19
#           thus, the string 'xxI Am x  a weird string' with a newline will become
19
#           thus, the string 'xxI Am x  a weird string' with a newline will become
20
#           'a weird string' with no newline
20
#           'a weird string' with no newline
21
# will also look for single and double quotes surrounding entire string and remove them
21
# will also look for single and double quotes surrounding entire string and remove them
22
# if they exisst
22
# if they exist
23
 
23
 
24
sub cleanUp {
24
sub cleanUp {
25
   my ($delimiter, $text) = @_;
25
   my ($delimiter, $text) = @_;
26
   chomp $text;
26
   chomp $text;
27
   if ( $text =~ m/[^$delimiter]*$delimiter\s*(.*)/ ) {
27
   if ( $delimiter && $text =~ m/[^$delimiter]*$delimiter\s*(.*)/ ) {
28
      $text = $1;
28
      $text = $1;
29
   }
29
   }
30
   if ( $text =~ m/^'(.*)'$/ ) {
30
   if ( $text =~ m/^'(.*)'$/ ) {
31
      $text = $1;
31
      $text = $1;
32
   }
32
   }