Fortran SFF API to data I/O streams in C++
fapid_sff_trimlen.f
Go to the documentation of this file.
1 c this is <fapid_sff_trimlen.f>
2 c ----------------------------------------------------------------------------
3 c
4 c Copyright (c) 2011 by Thomas Forbriger (BFO Schiltach)
5 c
6 c sff_TrimLen function copied from stuff.f
7 c
8 c ----
9 c This program is free software; you can redistribute it and/or modify
10 c it under the terms of the GNU General Public License as published by
11 c the Free Software Foundation; either version 2 of the License, or
12 c (at your option) any later version.
13 c
14 c This program is distributed in the hope that it will be useful,
15 c but WITHOUT ANY WARRANTY; without even the implied warranty of
16 c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 c GNU General Public License for more details.
18 c
19 c You should have received a copy of the GNU General Public License
20 c along with this program; if not, write to the Free Software
21 c Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 c ----
23 c
24 c
25 c REVISIONS and CHANGES
26 c 02/01/2011 V1.0 Thomas Forbriger
27 c
28 c ============================================================================
29 c
30 c This function is copied from stuff.f
31 c It is implemented in libfapidxx since it cannot be replaced by the intrinsic
32 c Fortran function index in all cases. index(string,' ')-1 finds the
33 c index of the last character only in cases where the string does not
34 c contain spaces.
35 c
36 cD
37 c----------------------------------------------------------------------
38  subroutine sff_trimlen(string,ntrim)
39 c
40 c give length of a string excluding trailing blanks
41 c Input:
42 c string: String to be trimmed
43 c Output:
44 c ntrim: length of string excluding trailing blanks
45 c
46  integer ntrim
47  character string*(*)
48 cE
49  do 10 ntrim=len(string),1,-1
50  10 if(string(ntrim:ntrim).ne.' ') return
51  ntrim = 1
52  return
53  end
54 c
55 c ----- END OF fapid_sff_trimlen.f -----