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');

# Replace the 1st occurrence of a substring with another string.
my $bFound = $sb->ReplaceFirst('::', '-');

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

# Output is:
# bFound = True
# sb contains: abc-def::ghi