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

 Indent::Utils - Utilities for Indent classes.

SYNOPSIS

 use Indent::Utils qw(line_size_check reduce_duplicit_ws remove_first_ws
         remove_last_ws remove_ws string_len);

 line_size_check($object_with_line_size_parameter);
 reduce_duplicit_ws(\$string);
 remove_first_ws(\$string);
 remove_last_ws(\$string);
 remove_ws(\$string);
 my $length_of_string = string_len($string);

GLOBAL VARIABLES

TAB_LENGTH
 Default length of tabelator is 8 chars.

SUBROUTINES

line_size_check

 line_size_check($object_with_line_size_parameter);

Line size 'line_size' parameter check.

reduce_duplicit_ws

 reduce_duplicit_ws(\$string);

Reduce duplicit blank space in string to one space.

remove_first_ws

 remove_first_ws(\$string);

Remove blank characters in begin of string.

remove_last_ws

 remove_last_ws(\$string);

Remove blank characters in end of string.

remove_ws

 remove_ws(\$string);

Remove white characters in begin and end of string.

string_len

 my $length_of_string = string_len($string);

Gets length of string.

ERRORS

 line_size_check():
         'line_size' parameter must be a positive number.
                 'line_size', %s

EXAMPLE1

 use strict;
 use warnings;

 use Indent::Utils qw(reduce_duplicit_ws);

 my $input = 'a  b';
 reduce_duplicit_ws(\$input);
 print "$input|\n";

 # Output:
 # a b|

EXAMPLE2

 use strict;
 use warnings;

 use Indent::Utils qw(remove_first_ws);

 my $input = '  a';
 remove_first_ws(\$input);
 print "$input|\n";

 # Output:
 # a|

EXAMPLE3

 use strict;
 use warnings;

 use Indent::Utils qw(remove_last_ws);

 my $input = 'a   ';
 remove_last_ws(\$input);
 print "$input|\n";

 # Output:
 # a|

EXAMPLE4

 use strict;
 use warnings;

 use Indent::Utils qw(remove_ws);

 my $input = '   a   ';
 remove_ws(\$input);
 print "$input|\n";

 # Output:
 # a|

EXAMPLE5

 use strict;
 use warnings;

 use Indent::Utils qw(string_len);

 # Print string length.
 print string_len("\tab\t")."\n";

 # Output:
 # 18

DEPENDENCIES

Error::Pure, Exporter, Readonly.

SEE ALSO

Indent

Class for indent handling.

Indent::Block

Class for block indenting.

Indent::Data

Class for data indenting.

Indent::String

Class for text indenting.

Indent::Word

Class for word indenting.

REPOSITORY

https://github.com/michal-josef-spacek/Indent

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

© 2005-2024 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.09