项目作者: eengl

项目描述 :
Fortran library and module which contains functions for common string manipulations.
高级语言: Fortran
项目地址: git://github.com/eengl/fortran-strings.git
创建时间: 2018-12-21T03:31:45Z
项目社区:https://github.com/eengl/fortran-strings

开源协议:GNU General Public License v3.0

下载


Status

fortran-strings

Introduction

fortran-strings is a Fortran library and module which contains functions for common string manipulations. The function ideas originate mainly from Python’s built-in string functions. The functions are accessible by using strings module in your Fortran code

use strings

The function names are prefixed with str_. The following is a list of available functions:

  • str_count - Count the occurrences of a substring in a string.
  • str_replace - Replace a substring with another substring within a parent string.
  • str_upper - Convert all letters to uppercase.
  • str_lower - Convert all letters to lowercase.
  • str_split - Split string based on a character delimiter and return string given by the column number.
  • str_uniq - Removed duplicative entries from a delimited string.
  • str_zfill - Pad a string with zeroes (“0”) to specified width. If width is <= input string width, then the original string is returned.
  • str_center - Center a string to a specified width. The default character to fill in the centered string is a blank character.
  • str_reverse - Reverse a string.
  • str_test - Return .true. is a substring is found in a string, .false. otherwise.
  • str_swapcase - Swap the case of letters in a string.

All functions return a deferred-length, allocatable character scalar (character(len=:), allocatable) with the exception of str_count which returns an integer and str_test which returns a logical.

For more detailed documentation, see https://eengl.github.io/fortran-strings/

Requirements

  • CMake v3.15+
  • Fortran compiler (tested with gfortran 4.8.4 and later)

Installation

  1. mkdir build
  2. cd build
  3. cmake -DCMAKE_INSTALL_PREFIX=/path/to/install /path/to/fortran-strings
  4. make
  5. make test
  6. make install