   write(*,'(a)')adjustc('  centered string               ')
 !  using explicit output string length
    write(*,'(a)')repeat('=',50)
    write(*,'(a)')adjustc('this is a centered string',50)
    write(*,'(a)')repeat('=',50)
 end program demo_adjustc

Expected output:

 \================================
         centered string
         centered string
         centered string
 \==================================================
             this is a centered string
 \======================================