Sample code for 30+ languages & platforms
Perl Requires Chilkat v9.5.0.77+

StringBuilder RemoveAfterFinal

Demonstrates the StringBuilder.RemoveAfterFinal method.

Chilkat Perl Downloads

Chilkat2 Perl
use strict;
use warnings;
use Chilkat2;

my $sb = Chilkat2::StringBuilder->new;
my $success = $sb->Append('abc::def::ghi');

# The RemoveAfterFinal method removes the chars after the final occurrence of the marker.
# It also removes the marker string.
# If the marker is not found, then nothing is removed and the method returns 0.
my $marker = '::';
my $bFound = $sb->RemoveAfterFinal($marker);

print 'bFound = ', ($bFound ? 1 : 0), "\n";
print 'sb contains: ', $sb->GetAsString(), "\n";

# Output is:
# bFound = 1
# sb contains: abc::def