User Control Panel
Advertisements

HELP US, HELP YOU!

String analyse

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Commands
View unanswered posts
Author Message
mat007
Almost An Agent
Almost An Agent


Joined: 12 Jan 2004
Posts: 1375

Reputation: 15.8Reputation: 15.8
votes: 2

PostPosted: Thu Jul 28, 2005 6:32 pm    Post subject: String analyse Reply with quote

Returns string: length, no vowels, vowels contained and the full string.

Code:
sub cmd_analyse {
   my($self, $username, $name, $msg) = @_;

   if($msg ne '') {
      my ($anaylyse_stv, $char);
      my $string_backup = $msg;
      $string_backup =~ s/A|E|I|O|U//ig;
      my @analyse_vow = split(//, $msg);
      foreach $char (@analyse_vow) {
         $char = lc($char);
         if($char eq 'a' or $char eq 'e' or $char eq 'i' or $char eq 'o' or $char eq 'u') {
            $anaylyse_stv .= $char . ", ";
         }
      }
      $anaylyse_stv = "No vowels contained!" if($anaylyse_stv eq '');
      $anaylyse_stv = substr($anaylyse_stv, 0, -2) if($anaylyse_stv ne 'No vowels contained!');
      return $self->sendMessage("String length: " . length($msg)
               . "\nString no vowels: $string_backup"
               . "\nString only vowels: $anaylyse_stv"
               . "\nString: $msg");
   } else {
      return $self->sendMessage("Error, Sorry you did not give any params.\n"
               . "Eg: !Analyse The cat jumped over the moon", Color => "0000CC") if($msg eq '');
   }
}
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Commands All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group