GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Venus::String(3) User Contributed Perl Documentation Venus::String(3)

Venus::String - String Class

String Class for Perl 5

  package main;
  use Venus::String;
  my $string = Venus::String->new('hello world');
  # $string->camelcase;

This package provides methods for manipulating string data.

This package inherits behaviors from:

Venus::Kind::Value

This package provides the following methods:

  append(string @parts) (string)

The append method appends arugments to the string using spaces.

Since 0.01

append example 1
  # given: synopsis;
  my $append = $string->append('welcome');
  # "hello world welcome"
    

  append_with(string $delimiter, string @parts) (string)

The append_with method appends arugments to the string using the delimiter provided.

Since 0.01

append_with example 1
  # given: synopsis;
  my $append = $string->append_with(', ', 'welcome');
  # "hello world, welcome"
    

  camelcase() (string)

The camelcase method converts the string to camelcase.

Since 0.01

camelcase example 1
  # given: synopsis;
  my $camelcase = $string->camelcase;
  # "helloWorld"
    

  cast(string $kind) (object | undef)

The cast method converts "value" objects between different "value" object types, based on the name of the type provided. This method will return "undef" if the invocant is not a Venus::Kind::Value.

Since 0.08

cast example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new;
  my $cast = $string->cast('array');
  # bless({ value => [""] }, "Venus::Array")
    
cast example 2
  package main;
  use Venus::String;
  my $string = Venus::String->new;
  my $cast = $string->cast('boolean');
  # bless({ value => 0 }, "Venus::Boolean")
    
cast example 3
  package main;
  use Venus::String;
  my $string = Venus::String->new;
  my $cast = $string->cast('code');
  # bless({ value => sub { ... } }, "Venus::Code")
    
cast example 4
  package main;
  use Venus::String;
  my $string = Venus::String->new;
  my $cast = $string->cast('float');
  # bless({ value => "0.0" }, "Venus::Float")
    
cast example 5
  package main;
  use Venus::String;
  my $string = Venus::String->new;
  my $cast = $string->cast('hash');
  # bless({ value => { "" => "" } }, "Venus::Hash")
    
cast example 6
  package main;
  use Venus::String;
  my $string = Venus::String->new;
  my $cast = $string->cast('number');
  # bless({ value => 0 }, "Venus::Float")
    
cast example 7
  package main;
  use Venus::String;
  my $string = Venus::String->new;
  my $cast = $string->cast('regexp');
  # bless({ value => qr/(?^u:)/ }, "Venus::Regexp")
    
cast example 8
  package main;
  use Venus::String;
  my $string = Venus::String->new;
  my $cast = $string->cast('scalar');
  # bless({ value => \"" }, "Venus::Scalar")
    
cast example 9
  package main;
  use Venus::String;
  my $string = Venus::String->new;
  my $cast = $string->cast('string');
  # bless({ value => "" }, "Venus::String")
    
cast example 10
  package main;
  use Venus::String;
  my $string = Venus::String->new;
  my $cast = $string->cast('undef');
  # bless({ value => undef }, "Venus::Undef")
    

  chomp() (string)

The chomp method removes the newline (or the current value of $/) from the end of the string.

Since 0.01

chomp example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new("name, age, dob, email\n");
  my $chomp = $string->chomp;
  # "name, age, dob, email"
    
chomp example 2
  package main;
  use Venus::String;
  my $string = Venus::String->new("name, age, dob, email\n\n");
  my $chomp = $string->chomp;
  # "name, age, dob, email\n"
    

  chop() (string)

The chop method removes and returns the last character of the string.

Since 0.01

chop example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new("this is just a test.");
  my $chop = $string->chop;
  # "this is just a test"
    

  concat(string @parts) (string)

The concat method returns the string with the argument list appended to it.

Since 0.01

concat example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new('ABC');
  my $concat = $string->concat('DEF', 'GHI');
  # "ABCDEFGHI"
    

  contains(string $expr) (boolean)

The contains method searches the string for a substring or expression returns true or false if found.

Since 0.01

contains example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new('Nullam ultrices placerat.');
  my $contains = $string->contains('trices');
  # 1
    
contains example 2
  package main;
  use Venus::String;
  my $string = Venus::String->new('Nullam ultrices placerat.');
  my $contains = $string->contains('itrices');
  # 0
    
contains example 3
  package main;
  use Venus::String;
  my $string = Venus::String->new('Nullam ultrices placerat.');
  my $contains = $string->contains(qr/trices/);
  # 1
    

  default() (string)

The default method returns the default value, i.e. ''.

Since 0.01

default example 1
  # given: synopsis;
  my $default = $string->default;
  # ""
    

  eq(any $arg) (boolean)

The eq method performs an "equals" operation using the argument provided.

Since 0.08

eq example 1
  package main;
  use Venus::Array;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Array->new;
  my $result = $lvalue->eq($rvalue);
  # 0
    
eq example 2
  package main;
  use Venus::Code;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Code->new;
  my $result = $lvalue->eq($rvalue);
  # 0
    
eq example 3
  package main;
  use Venus::Float;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Float->new;
  my $result = $lvalue->eq($rvalue);
  # 0
    
eq example 4
  package main;
  use Venus::Hash;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Hash->new;
  my $result = $lvalue->eq($rvalue);
  # 0
    
eq example 5
  package main;
  use Venus::Number;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Number->new;
  my $result = $lvalue->eq($rvalue);
  # 0
    
eq example 6
  package main;
  use Venus::Regexp;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Regexp->new;
  my $result = $lvalue->eq($rvalue);
  # 0
    
eq example 7
  package main;
  use Venus::Scalar;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Scalar->new;
  my $result = $lvalue->eq($rvalue);
  # 0
    
eq example 8
  package main;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::String->new;
  my $result = $lvalue->eq($rvalue);
  # 1
    
eq example 9
  package main;
  use Venus::String;
  use Venus::Undef;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Undef->new;
  my $result = $lvalue->eq($rvalue);
  # 1
    

  format(any @args) (string)

The format method performs a "sprintf" in perlfunc operation using the underlying string and arguments provided and returns the result.

Since 3.30

format example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new('hello %s');
  my $format = $string->format('world');
  # "hello world"
    
format example 2
  package main;
  use Venus::String;
  my $string = Venus::String->new('id number %08d');
  my $format = $string->format(10);
  # "id number 00000010"
    

  ge(any $arg) (boolean)

The ge method performs a "greater-than-or-equal-to" operation using the argument provided.

Since 0.08

ge example 1
  package main;
  use Venus::Array;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Array->new;
  my $result = $lvalue->ge($rvalue);
  # 0
    
ge example 2
  package main;
  use Venus::Code;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Code->new;
  my $result = $lvalue->ge($rvalue);
  # 0
    
ge example 3
  package main;
  use Venus::Float;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Float->new;
  my $result = $lvalue->ge($rvalue);
  # 0
    
ge example 4
  package main;
  use Venus::Hash;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Hash->new;
  my $result = $lvalue->ge($rvalue);
  # 0
    
ge example 5
  package main;
  use Venus::Number;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Number->new;
  my $result = $lvalue->ge($rvalue);
  # 0
    
ge example 6
  package main;
  use Venus::Regexp;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Regexp->new;
  my $result = $lvalue->ge($rvalue);
  # 0
    
ge example 7
  package main;
  use Venus::Scalar;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Scalar->new;
  my $result = $lvalue->ge($rvalue);
  # 0
    
ge example 8
  package main;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::String->new;
  my $result = $lvalue->ge($rvalue);
  # 1
    
ge example 9
  package main;
  use Venus::String;
  use Venus::Undef;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Undef->new;
  my $result = $lvalue->ge($rvalue);
  # 1
    

  gele(any $arg1, any $arg2) (boolean)

The gele method performs a "greater-than-or-equal-to" operation on the 1st argument, and "lesser-than-or-equal-to" operation on the 2nd argument.

Since 0.08

gele example 1
  package main;
  use Venus::Array;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Array->new;
  my $result = $lvalue->gele($rvalue);
  # 0
    
gele example 2
  package main;
  use Venus::Code;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Code->new;
  my $result = $lvalue->gele($rvalue);
  # 0
    
gele example 3
  package main;
  use Venus::Float;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Float->new;
  my $result = $lvalue->gele($rvalue);
  # 0
    
gele example 4
  package main;
  use Venus::Hash;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Hash->new;
  my $result = $lvalue->gele($rvalue);
  # 0
    
gele example 5
  package main;
  use Venus::Number;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Number->new;
  my $result = $lvalue->gele($rvalue);
  # 0
    
gele example 6
  package main;
  use Venus::Regexp;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Regexp->new;
  my $result = $lvalue->gele($rvalue);
  # 0
    
gele example 7
  package main;
  use Venus::Scalar;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Scalar->new;
  my $result = $lvalue->gele($rvalue);
  # 0
    
gele example 8
  package main;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::String->new;
  my $result = $lvalue->gele($rvalue);
  # 1
    
gele example 9
  package main;
  use Venus::String;
  use Venus::Undef;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Undef->new;
  my $result = $lvalue->gele($rvalue);
  # 1
    

  gt(any $arg) (boolean)

The gt method performs a "greater-than" operation using the argument provided.

Since 0.08

gt example 1
  package main;
  use Venus::Array;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Array->new;
  my $result = $lvalue->gt($rvalue);
  # 0
    
gt example 2
  package main;
  use Venus::Code;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Code->new;
  my $result = $lvalue->gt($rvalue);
  # 0
    
gt example 3
  package main;
  use Venus::Float;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Float->new;
  my $result = $lvalue->gt($rvalue);
  # 0
    
gt example 4
  package main;
  use Venus::Hash;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Hash->new;
  my $result = $lvalue->gt($rvalue);
  # 0
    
gt example 5
  package main;
  use Venus::Number;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Number->new;
  my $result = $lvalue->gt($rvalue);
  # 0
    
gt example 6
  package main;
  use Venus::Regexp;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Regexp->new;
  my $result = $lvalue->gt($rvalue);
  # 0
    
gt example 7
  package main;
  use Venus::Scalar;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Scalar->new;
  my $result = $lvalue->gt($rvalue);
  # 0
    
gt example 8
  package main;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::String->new;
  my $result = $lvalue->gt($rvalue);
  # 0
    
gt example 9
  package main;
  use Venus::String;
  use Venus::Undef;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Undef->new;
  my $result = $lvalue->gt($rvalue);
  # 0
    

  gtlt(any $arg1, any $arg2) (boolean)

The gtlt method performs a "greater-than" operation on the 1st argument, and "lesser-than" operation on the 2nd argument.

Since 0.08

gtlt example 1
  package main;
  use Venus::Array;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Array->new;
  my $result = $lvalue->gtlt($rvalue);
  # 0
    
gtlt example 2
  package main;
  use Venus::Code;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Code->new;
  my $result = $lvalue->gtlt($rvalue);
  # 0
    
gtlt example 3
  package main;
  use Venus::Float;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Float->new;
  my $result = $lvalue->gtlt($rvalue);
  # 0
    
gtlt example 4
  package main;
  use Venus::Hash;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Hash->new;
  my $result = $lvalue->gtlt($rvalue);
  # 0
    
gtlt example 5
  package main;
  use Venus::Number;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Number->new;
  my $result = $lvalue->gtlt($rvalue);
  # 0
    
gtlt example 6
  package main;
  use Venus::Regexp;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Regexp->new;
  my $result = $lvalue->gtlt($rvalue);
  # 0
    
gtlt example 7
  package main;
  use Venus::Scalar;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Scalar->new;
  my $result = $lvalue->gtlt($rvalue);
  # 0
    
gtlt example 8
  package main;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::String->new;
  my $result = $lvalue->gtlt($rvalue);
  # 0
    
gtlt example 9
  package main;
  use Venus::String;
  use Venus::Undef;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Undef->new;
  my $result = $lvalue->gtlt($rvalue);
  # 0
    

  hex() (string)

The hex method returns the value resulting from interpreting the string as a hex string.

Since 0.01

hex example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new('0xaf');
  my $hex = $string->hex;
  # 175
    

  index(string $substr, number $start) (number)

The index method searches for the argument within the string and returns the position of the first occurrence of the argument.

Since 0.01

index example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new('unexplainable');
  my $index = $string->index('explain');
  # 2
    
index example 2
  package main;
  use Venus::String;
  my $string = Venus::String->new('unexplainable');
  my $index = $string->index('explain', 1);
  # 2
    
index example 3
  package main;
  use Venus::String;
  my $string = Venus::String->new('unexplainable');
  my $index = $string->index('explained');
  # -1
    

  kebabcase() (string)

The kebabcase method converts the string to kebabcase.

Since 0.09

kebabcase example 1
  # given: synopsis;
  my $kebabcase = $string->kebabcase;
  # "hello-world"
    

  lc() (string)

The lc method returns a lowercased version of the string.

Since 0.01

lc example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new('Hello World');
  my $lc = $string->lc;
  # "hello world"
    

  lcfirst() (string)

The lcfirst method returns a the string with the first character lowercased.

Since 0.01

lcfirst example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new('Hello World');
  my $lcfirst = $string->lcfirst;
  # "hello World"
    

  le(any $arg) (boolean)

The le method performs a "lesser-than-or-equal-to" operation using the argument provided.

Since 0.08

le example 1
  package main;
  use Venus::Array;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Array->new;
  my $result = $lvalue->le($rvalue);
  # 1
    
le example 2
  package main;
  use Venus::Code;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Code->new;
  my $result = $lvalue->le($rvalue);
  # 1
    
le example 3
  package main;
  use Venus::Float;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Float->new;
  my $result = $lvalue->le($rvalue);
  # 1
    
le example 4
  package main;
  use Venus::Hash;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Hash->new;
  my $result = $lvalue->le($rvalue);
  # 1
    
le example 5
  package main;
  use Venus::Number;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Number->new;
  my $result = $lvalue->le($rvalue);
  # 1
    
le example 6
  package main;
  use Venus::Regexp;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Regexp->new;
  my $result = $lvalue->le($rvalue);
  # 1
    
le example 7
  package main;
  use Venus::Scalar;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Scalar->new;
  my $result = $lvalue->le($rvalue);
  # 1
    
le example 8
  package main;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::String->new;
  my $result = $lvalue->le($rvalue);
  # 1
    
le example 9
  package main;
  use Venus::String;
  use Venus::Undef;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Undef->new;
  my $result = $lvalue->le($rvalue);
  # 1
    

  length() (number)

The length method returns the number of characters within the string.

Since 0.01

length example 1
  # given: synopsis;
  my $length = $string->length;
  # 11
    

  lines() (within[arrayref, string])

The lines method returns an arrayref of parts by splitting on 1 or more newline characters.

Since 0.01

lines example 1
  # given: synopsis;
  my $lines = $string->lines;
  # ["hello world"]
    
lines example 2
  package main;
  use Venus::String;
  my $string = Venus::String->new("who am i?\nwhere am i?\nhow did I get here");
  my $lines = $string->lines;
  # ["who am i?", "where am i?", "how did I get here"]
    

  lowercase() (string)

The lowercase method is an alias to the lc method.

Since 0.01

lowercase example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new('Hello World');
  my $lowercase = $string->lowercase;
  # "hello world"
    

  lt(any $arg) (boolean)

The lt method performs a "lesser-than" operation using the argument provided.

Since 0.08

lt example 1
  package main;
  use Venus::Array;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Array->new;
  my $result = $lvalue->lt($rvalue);
  # 1
    
lt example 2
  package main;
  use Venus::Code;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Code->new;
  my $result = $lvalue->lt($rvalue);
  # 1
    
lt example 3
  package main;
  use Venus::Float;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Float->new;
  my $result = $lvalue->lt($rvalue);
  # 1
    
lt example 4
  package main;
  use Venus::Hash;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Hash->new;
  my $result = $lvalue->lt($rvalue);
  # 1
    
lt example 5
  package main;
  use Venus::Number;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Number->new;
  my $result = $lvalue->lt($rvalue);
  # 1
    
lt example 6
  package main;
  use Venus::Regexp;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Regexp->new;
  my $result = $lvalue->lt($rvalue);
  # 1
    
lt example 7
  package main;
  use Venus::Scalar;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Scalar->new;
  my $result = $lvalue->lt($rvalue);
  # 1
    
lt example 8
  package main;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::String->new;
  my $result = $lvalue->lt($rvalue);
  # 0
    
lt example 9
  package main;
  use Venus::String;
  use Venus::Undef;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Undef->new;
  my $result = $lvalue->lt($rvalue);
  # 0
    

  ne(any $arg) (boolean)

The ne method performs a "not-equal-to" operation using the argument provided.

Since 0.08

ne example 1
  package main;
  use Venus::Array;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Array->new;
  my $result = $lvalue->ne($rvalue);
  # 1
    
ne example 2
  package main;
  use Venus::Code;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Code->new;
  my $result = $lvalue->ne($rvalue);
  # 1
    
ne example 3
  package main;
  use Venus::Float;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Float->new;
  my $result = $lvalue->ne($rvalue);
  # 1
    
ne example 4
  package main;
  use Venus::Hash;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Hash->new;
  my $result = $lvalue->ne($rvalue);
  # 1
    
ne example 5
  package main;
  use Venus::Number;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Number->new;
  my $result = $lvalue->ne($rvalue);
  # 1
    
ne example 6
  package main;
  use Venus::Regexp;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Regexp->new;
  my $result = $lvalue->ne($rvalue);
  # 1
    
ne example 7
  package main;
  use Venus::Scalar;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Scalar->new;
  my $result = $lvalue->ne($rvalue);
  # 1
    
ne example 8
  package main;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::String->new;
  my $result = $lvalue->ne($rvalue);
  # 0
    
ne example 9
  package main;
  use Venus::String;
  use Venus::Undef;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Undef->new;
  my $result = $lvalue->ne($rvalue);
  # 0
    

  numified() (number)

The numified method returns the numerical representation of the object. For string objects this method returns the underlying value, if that value looks like a number, or 0.

Since 0.08

numified example 1
  # given: synopsis;
  my $numified = $string->numified;
  # 11
    
numified example 2
  package main;
  use Venus::String;
  my $string = Venus::String->new(1_000_000);
  my $numified = $string->numified;
  # 1000000
    

  pascalcase() (string)

The pascalcase method converts the string to pascalcase.

Since 0.01

pascalcase example 1
  # given: synopsis;
  my $pascalcase = $string->pascalcase;
  # "HelloWorld"
    

  prepend(string @parts) (string)

The prepend method prepends arugments to the string using spaces.

Since 0.01

prepend example 1
  # given: synopsis;
  my $prepend = $string->prepend('welcome');
  # "welcome hello world"
    

  prepend_with(string $delimiter, string @parts) (string)

The prepend_with method prepends arugments to the string using the delimiter provided.

Since 0.01

prepend_with example 1
  # given: synopsis;
  my $prepend = $string->prepend_with(', ', 'welcome');
  # "welcome, hello world"
    

  render(hashref $tokens) (string)

The render method treats the string as a template and performs a simple token replacement using the argument provided.

Since 0.01

render example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new('Hi, {{name}}!');
  my $render = $string->render({name => 'Friend'});
  # "Hi, Friend!"
    

  repeat(number $number, string $delimiter) (string)

The repeat method repeats the string value N times based on the number provided and returns a new concatenated string. Optionally, a delimiter can be provided and be place between the occurences.

Since 0.01

repeat example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new('999');
  my $repeat = $string->repeat(2);
  # "999999"
    
repeat example 2
  package main;
  use Venus::String;
  my $string = Venus::String->new('999');
  my $repeat = $string->repeat(2, ',');
  # "999,999"
    

  replace(regexp $regexp, string $replace, string $flags) (Venus::Replace)

The replace method performs a search and replace operation and returns the Venus::Replace object.

Since 0.01

replace example 1
  # given: synopsis;
  my $replace = $string->replace('world', 'universe');
  # bless({
  #   ...,
  #   "flags"   => "",
  #   "regexp"  => "world",
  #   "string"  => "hello world",
  #   "substr"  => "universe",
  # }, "Venus::Replace")
    

  reverse() (string)

The reverse method returns a string where the characters in the string are in the opposite order.

Since 0.01

reverse example 1
  # given: synopsis;
  my $reverse = $string->reverse;
  # "dlrow olleh"
    

  rindex(string $substr, number $start) (string)

The rindex method searches for the argument within the string and returns the position of the last occurrence of the argument.

Since 0.01

rindex example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new('explain the unexplainable');
  my $rindex = $string->rindex('explain');
  # 14
    
rindex example 2
  package main;
  use Venus::String;
  my $string = Venus::String->new('explain the unexplainable');
  my $rindex = $string->rindex('explained');
  # -1
    
rindex example 3
  package main;
  use Venus::String;
  my $string = Venus::String->new('explain the unexplainable');
  my $rindex = $string->rindex('explain', 21);
  # 14
    
  search(regexp $regexp) (Venus::Search)

The search method performs a search operation and returns the Venus::Search object.

Since 0.01

search example 1
  # given: synopsis;
  my $search = $string->search('world');
  # bless({
  #   ...,
  #   "flags"   => "",
  #   "regexp"  => "world",
  #   "string"  => "hello world",
  # }, "Venus::Search")
    

  snakecase() (string)

The snakecase method converts the string to snakecase.

Since 0.01

snakecase example 1
  # given: synopsis;
  my $snakecase = $string->snakecase;
  # "hello_world"
    

  split(string | regexp $expr, maybe[number] $limit) (arrayref)

The split method returns an arrayref by splitting the string on the argument.

Since 0.01

split example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new('name, age, dob, email');
  my $split = $string->split(', ');
  # ["name", "age", "dob", "email"]
    
split example 2
  package main;
  use Venus::String;
  my $string = Venus::String->new('name, age, dob, email');
  my $split = $string->split(', ', 2);
  # ["name", "age, dob, email"]
    
split example 3
  package main;
  use Venus::String;
  my $string = Venus::String->new('name, age, dob, email');
  my $split = $string->split(qr/\,\s*/);
  # ["name", "age", "dob", "email"]
    

  stringified() (string)

The stringified method returns the object, stringified (i.e. a dump of the object's value).

Since 0.08

stringified example 1
  # given: synopsis;
  my $stringified = $string->stringified;
  # "hello world"
    
stringified example 2
  package main;
  use Venus::String;
  my $string = Venus::String->new("hello\nworld");
  my $stringified = $string->stringified;
  # "hello\\nworld"
    

  strip() (string)

The strip method returns the string replacing occurences of 2 or more whitespaces with a single whitespace.

Since 0.01

strip example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new('one,  two,  three');
  my $strip = $string->strip;
  # "one, two, three"
    

  substr(number $offset, number $length, string $replace) (string)

The substr method calls the core "substr" function with the object's string value. In list context returns the result and the subject.

Since 0.01

substr example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new('hello world');
  my $substr = $string->substr(0, 5);
  # "hello"
    
substr example 2
  package main;
  use Venus::String;
  my $string = Venus::String->new('hello world');
  my $substr = $string->substr(6, 5);
  # "world"
    
substr example 3
  package main;
  use Venus::String;
  my $string = Venus::String->new('hello world');
  my $substr = $string->substr(6, 5, 'universe');
  # "hello universe"
    
substr example 4
  package main;
  use Venus::String;
  my $string = Venus::String->new('hello world');
  my ($result, $subject) = $string->substr(6, 5, 'universe');
  # ("world", "hello universe")
    

  template(string | coderef $code, any @args) (any)

The template method uses the underlying string value to build and return a Venus::Template object, or dispatches to the coderef or method provided.

Since 3.04

template example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new('hello {{name}}');
  my $template = $string->template;
  # bless({...}, "Venus::Template")
    
template example 2
  package main;
  use Venus::String;
  my $string = Venus::String->new('hello {{name}}');
  my $template = $string->template('render', undef, {
    name => 'user',
  });
  # "hello user"
    

  titlecase() (string)

The titlecase method returns the string capitalizing the first character of each word.

Since 0.01

titlecase example 1
  # given: synopsis;
  my $titlecase = $string->titlecase;
  # "Hello World"
    

  trim() (string)

The trim method removes one or more consecutive leading and/or trailing spaces from the string.

Since 0.01

trim example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new('   system is   ready   ');
  my $trim = $string->trim;
  # "system is   ready"
    

  tv(any $arg) (boolean)

The tv method performs a "type-and-value-equal-to" operation using argument provided.

Since 0.08

tv example 1
  package main;
  use Venus::Array;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Array->new;
  my $result = $lvalue->tv($rvalue);
  # 0
    
tv example 2
  package main;
  use Venus::Code;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Code->new;
  my $result = $lvalue->tv($rvalue);
  # 0
    
tv example 3
  package main;
  use Venus::Float;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Float->new;
  my $result = $lvalue->tv($rvalue);
  # 0
    
tv example 4
  package main;
  use Venus::Hash;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Hash->new;
  my $result = $lvalue->tv($rvalue);
  # 0
    
tv example 5
  package main;
  use Venus::Number;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Number->new;
  my $result = $lvalue->tv($rvalue);
  # 0
    
tv example 6
  package main;
  use Venus::Regexp;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Regexp->new;
  my $result = $lvalue->tv($rvalue);
  # 0
    
tv example 7
  package main;
  use Venus::Scalar;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Scalar->new;
  my $result = $lvalue->tv($rvalue);
  # 0
    
tv example 8
  package main;
  use Venus::String;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::String->new;
  my $result = $lvalue->tv($rvalue);
  # 1
    
tv example 9
  package main;
  use Venus::String;
  use Venus::Undef;
  my $lvalue = Venus::String->new;
  my $rvalue = Venus::Undef->new;
  my $result = $lvalue->tv($rvalue);
  # 0
    

  uc() (string)

The uc method returns an uppercased version of the string.

Since 0.01

uc example 1
  # given: synopsis;
  my $uc = $string->uc;
  # "HELLO WORLD"
    

  ucfirst() (string)

The ucfirst method returns a the string with the first character uppercased.

Since 0.01

ucfirst example 1
  # given: synopsis;
  my $ucfirst = $string->ucfirst;
  # "Hello world"
    

  uppercase() (string)

The uppercase method is an alias to the uc method.

Since 0.01

uppercase example 1
  # given: synopsis;
  my $uppercase = $string->uppercase;
  # "HELLO WORLD"
    

  words() (within[arrayref, string])

The words method returns an arrayref by splitting on 1 or more consecutive spaces.

Since 0.01

words example 1
  package main;
  use Venus::String;
  my $string = Venus::String->new(
    'is this a bug we\'re experiencing'
  );
  my $words = $string->words;
  # ["is", "this", "a", "bug", "we're", "experiencing"]
    

This package overloads the following operators:

This package overloads the "" operator.

example 1

  # given: synopsis;
  my $result = "$string";
  # "hello world"
    

example 2

  # given: synopsis;
  my $result = "$string, $string";
  # "hello world, hello world"
    
This package overloads the "eq" operator.

example 1

  # given: synopsis;
  my $result = $string eq 'hello world';
  # 1
    

example 2

  package main;
  use Venus::String;
  my $string1 = Venus::String->new('hello world');
  my $string2 = Venus::String->new('hello world');
  my $result = $string1 eq $string2;
  # 1
    
This package overloads the "ne" operator.

example 1

  # given: synopsis;
  my $result = $string ne 'Hello world';
  # 1
    

example 2

  package main;
  use Venus::String;
  my $string1 = Venus::String->new('hello world');
  my $string2 = Venus::String->new('Hello world');
  my $result = $string1 ne $string2;
  # 1
    
This package overloads the "qr" operator.

example 1

  # given: synopsis;
  my $test = 'hello world' =~ qr/$string/;
  # 1
    

Awncorp, "awncorp@cpan.org"

Copyright (C) 2022, Awncorp, "awncorp@cpan.org".

This program is free software, you can redistribute it and/or modify it under the terms of the Apache license version 2.0.

2023-11-27 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.