@@ -381,4 +381,112 @@ program demo_replace_all
381381 ! string <-- "technology here, technology there, technology everywhere"
382382
383383end program demo_replace_all
384- ```
384+ ```
385+
386+
387+ <!-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -->
388+ ### ` padl `
389+
390+ #### Description
391+
392+ Returns a string of length ` output_length ` left padded with ` pad_with ` character if it is provided, otherwise with ` " " ` (1 whitespace).
393+ If ` output_length ` is less than or equal to the length of ` string ` , padding is not performed.
394+
395+ #### Syntax
396+
397+ ` string = [[stdlib_strings(module):padl(interface)]] (string, output_length [, pad_with]) `
398+
399+ #### Status
400+
401+ Experimental
402+
403+ #### Class
404+
405+ Pure function
406+
407+ #### Argument
408+
409+ - ` string ` : Character scalar or [[ stdlib_string_type(module): string_type (type)]] .
410+ This argument is intent(in).
411+ - ` output_length ` : integer.
412+ This argument is intent(in).
413+ - ` pad_with ` : Character scalar of length 1.
414+ This argument is intent(in) and optional.
415+
416+ #### Result value
417+
418+ The result is of the same type as ` string ` .
419+
420+ #### Example
421+
422+ ``` fortran
423+ program demo_padl
424+ use stdlib_string_type, only: string_type, assignment(=)
425+ use stdlib_strings, only : padl
426+ implicit none
427+ string_type :: string
428+
429+ string = "left pad this string"
430+ ! string <-- "left pad this string"
431+
432+ print *, padl(string, 25, "$") ! "$$$$$left pad this string"
433+
434+ string = padl(string, 25)
435+ ! string <-- " left pad this string"
436+
437+ end program demo_padl
438+ ```
439+
440+
441+ <!-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -->
442+ ### ` padr `
443+
444+ #### Description
445+
446+ Returns a string of length ` output_length ` right padded with ` pad_with ` character if it is provided, otherwise with ` " " ` (1 whitespace).
447+ If ` output_length ` is less than or equal to the length of ` string ` , padding is not performed.
448+
449+ #### Syntax
450+
451+ ` string = [[stdlib_strings(module):padr(interface)]] (string, output_length [, pad_with]) `
452+
453+ #### Status
454+
455+ Experimental
456+
457+ #### Class
458+
459+ Pure function
460+
461+ #### Argument
462+
463+ - ` string ` : Character scalar or [[ stdlib_string_type(module): string_type (type)]] .
464+ This argument is intent(in).
465+ - ` output_length ` : integer.
466+ This argument is intent(in).
467+ - ` pad_with ` : Character scalar of length 1.
468+ This argument is intent(in) and optional.
469+
470+ #### Result value
471+
472+ The result is of the same type as ` string ` .
473+
474+ #### Example
475+
476+ ``` fortran
477+ program demo_padr
478+ use stdlib_string_type, only: string_type, assignment(=)
479+ use stdlib_strings, only : padr
480+ implicit none
481+ string_type :: string
482+
483+ string = "right pad this string"
484+ ! string <-- "right pad this string"
485+
486+ print *, padr(string, 25, "$") ! "right pad this string$$$$"
487+
488+ string = padr(string, 25)
489+ ! string <-- "right pad this string "
490+
491+ end program demo_padr
492+ ```
0 commit comments