Catmandu::Fix::format(3pm)

Catmandu::Fix::format3pm

Replace the value with a formatted (sprintf-like) version

Usage

   # e.g. number: 41
   format(number,"%-10.10d") # number => "0000000041"
   # e.g. numbers: 
   #         - 41
   #         - 15
   format(number,"%-10.10d %-5.5d") # numbers => "0000000041 00015"
   # e.g. hash:
   #        name: Albert
   format(name,"%-10s: %s") # hash: "name      : Albert"
   # e.g. array:
   #         - 1
   format(array,"%d %d %d") # Fails! The array contains only one value, but you request 3 values 
   # Test first if the array contains 3 values
   if exists(array.2)
     format(array,"%d %d %d")
   end

Overview

Create a string formatted by the usual printf conventions of the C library function sprintf. See <http://perldoc.perl.org/functions/sprintf.html> for a complete description.

Releases

5 releases since Debian 9 (Stretch); the text changed 4 times.

  1. 9
  2. 10
  3. 11
  4. 12
  5. 13

From libcatmandu-perl 1.2024-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.