Append to string in Fortran

I have a very simple problem, that i am yet to find an answer to. Is there any way in which i can append a character, in particular a white space to a character that has already been initialized in FORTRAN. Apparently

CHARACTER(2000) :: result
result = ''
result = result//' '

Does not work. Thank you very much for your time!


What do you want to achieve? Of course it works, but it has not much use. Try the approach you have been already suggested in your previous question. In particular, be aware that all strings are filled with space after their last non-space character, this is very important!

'a'//' ' really produces  'a '


result = result//' '

produces a 2001 character string, which is then truncated on assignment, so that result ends up being the same.

You may want

result = trim(result)//' '

but it is also useless, because the string is filled with spaces anyway.

If you want to make the variable larger, you have to use:

character(:),allocatable:: result
result = ''  !now contains ' ' and has length 1
result = result//' ' !now contains '  ' and has length 2

You have to enable reallocation on assignment on some processors.

Need Your Help

Best way to find maximum integer inside a string array?

java java-8 java-stream

String[] array = new String[] {"1", "2", "3", "25"};

How to convert System.Int64 to Array in jquery


Im sending a list from my controller class to my View which contain a list of values of type long. Now i want to traverse on that list in jquery to be able to view these values and perform my next