@@ -339,7 +339,7 @@ Format or transfer a integer/real/complex/logical variable as a character sequen
339
339
340
340
#### Syntax
341
341
342
- ` format_string = [[stdlib_strings(module):format_string(interface)]] (value[, format]) `
342
+ ` format_string = [[stdlib_strings(module):format_string(interface)]] (value [, format]) `
343
343
344
344
#### Status
345
345
@@ -367,24 +367,43 @@ program demo_strings_format_string
367
367
use, non_intrinsic :: stdlib_strings, only: format_string
368
368
implicit none
369
369
print *, 'format_string(complex) : '
370
- print *, format_string((1, 1)) ! (1.00000000,1.00000000)
371
- print *, format_string((1, 1), '(F6.2)') ! (1.00,1.00)
372
- print *, format_string((1, 1), '(F6.2)'), format_string((2, 2), '(F7.3)') ! (1.00,1.00)(2.000,2.000)
370
+ print *, format_string((1, 1))
371
+ print *, format_string((1, 1), '(F6.2)')
372
+ print *, format_string((1, 1), '(F6.2)'), format_string((2, 2), '(F7.3)')
373
373
print *, 'format_string(integer) : '
374
- print *, format_string(100) ! 100
375
- print *, format_string(100, '(I6)') ! 100
376
- print *, format_string(100, '(I6)'), format_string(1000, '(I7)') ! 1001000
374
+ print *, format_string(100)
375
+ print *, format_string(100, '(I6)')
376
+ print *, format_string(100, '(I6)'), format_string(1000, '(I7)')
377
377
print *, 'format_string(real) : '
378
- print *, format_string(100.) ! 100.000000
379
- print *, format_string(100., '(F6 .2)') ! 100.00
378
+ print *, format_string(100.)
379
+ print *, format_string(100., '(F12 .2)')
380
380
print *, format_string(100., '(F6.2)'), &
381
- format_string(1000., '(F7.3)'), format_string(1000, '(F7.3)') ! 100.00********
381
+ format_string(1000., '(F7.3)'), format_string(1000, '(F7.3)')
382
382
!! Wrong demonstration
383
383
print *, 'format_string(logical) : '
384
- print *, format_string(.true.) ! T
385
- print *, format_string(.true., '(L2)') ! T
384
+ print *, format_string(.true.)
385
+ print *, format_string(.true., '(L2)')
386
386
print *, format_string(.false., '(L2)'), format_string(.true., '(L5)'), &
387
- format_string(.false., '(I5)') ! FT*
387
+ format_string(.false., '(I5)')
388
388
!! Wrong demonstration
389
389
end program demo_strings_format_string
390
390
```
391
+ ** Results**
392
+ ``` fortran
393
+ format_string(complex) :
394
+ (1.00000000,1.00000000)
395
+ ( 1.00, 1.00)
396
+ ( 1.00, 1.00) ( 2.000, 2.000)
397
+ format_string(integer) :
398
+ 100
399
+ 100
400
+ 100 1000
401
+ format_string(real) :
402
+ 100.000000
403
+ 100.00
404
+ 100.00********
405
+ format_string(logical) :
406
+ T
407
+ T
408
+ F T*
409
+ ```
0 commit comments