The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Devel::Ladybug::Str - Overloaded object class for strings

DESCRIPTION

Extends Devel::Ladybug::Scalar, Mime::Base64, and Unicode::String.

SYNOPSIS

  use Devel::Ladybug::Str;

  my $string = Devel::Ladybug::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 Devel::Ladybug::Array containing the split elements.

      my $scalar = Devel::Ladybug::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 Devel::Ladybug.