There is no inbuilt function that does exactly what you want.
The translator codes for writing the nastran input files would be written in Fortran or C etc and will be implementing this in their native code. It is a seemingly simple but in practice quite involved exercise to get the most accuracy into a Nastran 8 digit real string from a real number of arbitrary magnitude. The challenge is to change the format conversion depending on the magnitude and also to account for rounding.
The following function will give you an idea how you might do this in PCL though performance may be poor.
The example does not extract the maximum accuracy for small numbers like -0.098765 which will come out as -0.09877 when the most accurate for NASTRAN is -.098765 , to get this accuracy requires doing the real to string conversion with another digit of accuracy and then trimming the leading 0 from the resultant string, but leaving any negative sign in place.
Also remember that for small numbers with negative exponential data it is possible to change format like "-0.1234E-5" to "-.1234-5" which gains 2 more digits compared with truncating the number as "-0.12E-5", again this example code does not do this.
Hopefully the example will help but working with the wide field 16 digits is of course much easier and more accurate though people do like the 8 character wide fields despite their lack of significant digits.