https://github.com/eengl/fortran-strings
Fortran library and module which contains functions for common string manipulations.
https://github.com/eengl/fortran-strings
fortran fortran-library string-manipulation strings
Last synced: 5 months ago
JSON representation
Fortran library and module which contains functions for common string manipulations.
- Host: GitHub
- URL: https://github.com/eengl/fortran-strings
- Owner: eengl
- License: gpl-3.0
- Created: 2018-12-21T03:31:45.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-03-28T19:19:53.000Z (over 1 year ago)
- Last Synced: 2025-06-02T01:32:09.646Z (6 months ago)
- Topics: fortran, fortran-library, string-manipulation, strings
- Language: Fortran
- Homepage: https://eengl.github.io/fortran-strings/
- Size: 250 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# 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](https://docs.python.org/3.7/library/stdtypes.html#string-methods) 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
```bash
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/path/to/install /path/to/fortran-strings
make
make test
make install
```