Name

neat( )

Synopsis

DBI::neat(string[, length])

This returns a string given as the first argument of the function, placed in quotes, for an optional maximum length given as the second argument.

#!/usr/bin/perl -w
use DBI;
my $test = "This is a test.";
print "Test: " . DBI::neat($test, 8) . "\n\n";
exit;

Here are the results of running this script:

Test: 'This is...'

Notice that the results are in single quotes, that the text was truncated based on the maximum length given, and that ellipses were automatically placed at the end of the string. To neaten a list of strings, use the neat_list() function.

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.