NAME

OP::Str - Overloaded object class for strings

DESCRIPTION

Extends OP::Scalar, Mime::Base64, and Unicode::String.

SYNOPSIS

use OP::Str;

my $string = OP::Str->new("Lorem Ipsum");

#
# Overloaded to work like a native string
#
print "$string\n";

if ( $string =~ /Ipsum/ ) {
  print "Word\n";
}

PUBLIC INSTANCE METHODS

  • $self->split($splitRegex)

    Object wrapper for Perl's built-in split() function. Functionally the same as split($splitStr, $self).

    Returns a new OP::Array containing the split elements.

    my $scalar = OP::Scalar->new("Foo, Bar, Rebar, D-bar");
    
    my $array  = $scalar->split(qr/, */);
    
    $array->each( sub {
      print "Have item: $_\n";
    } );
    
    # Have item: Foo
    # Have item: Bar
    # Have item: Rebar
    # Have item: D-bar
  • chomp, chop, chr, crypt, eval, index, lc, lcfirst, length, rindex, substr, uc, ucfirst

    These object methods are wrappers to built-in Perl functions. See perlfunc.

SEE ALSO

This file is part of OP.