StringiFor
February 28, 2026 ยท View on GitHub
Strings Fortran Manipulator with steroids
a pure Fortran 2003+ library providing an OOP
stringtype with Python-like methods for modern Fortran projects.
๐ค Rich String APIupper, lower, camelcase, snakecase, split, join, replace, search, unique โ Python-like methods on modern Fortran strings | ๐ข Number Casting Assign any PENF integer or real kind directly to a string; cast back with to_number(kind=...) at compile-time | ๐ File & Path I/Oread_file, write_file, read_line, write_line, basedir, basename, extension, glob โ batteries included | ๐จ Encoding & Color Base64 encode/decode via BeFoR64; ANSI terminal colorize via FACE |
|---|---|---|---|
| โก Pure & Elemental Almost all methods are pure or elemental โ thread-safe, no side effects | ๐ Seamless Interop Overloaded =, //, and comparison operators โ string is a drop-in for standard character | ๐ Multi-licensed GPL v3 ยท BSD 2/3-Clause ยท MIT | ๐ฆ Multiple build systems fpm, FoBiS, CMake, Make |
For full documentations (guide, tutorial, examples, etc...) see the StringiFor website.
Authors
- Stefano Zaghi โ @szaghi
Contributions are welcome โ see the Contributing page.
Copyrights
This project is distributed under a multi-licensing system:
- FOSS projects: GPL v3
- Closed source / commercial: BSD 2-Clause, BSD 3-Clause, or MIT
Anyone interested in using, developing, or contributing to this project is welcome โ pick the license that best fits your needs.
Quick start
use stringifor
implicit none
type(string) :: s
s = 'Hello, World!'
print "(A)", s%upper()//'' ! HELLO, WORLD!
print "(A)", s%replace(old='World', new='Fortran')//'' ! Hello, Fortran!
print "(A)", s%camelcase()//'' ! Hello,World!
s = 3.14159_R8P
print "(A)", s//'' ! +3.14159000000000E+00
print "(L1)", s%is_real() ! T
Install
FoBiS
Standalone โ clone, fetch dependencies, and build:
git clone https://github.com/szaghi/StringiFor && cd StringiFor
FoBiS.py fetch # fetch PENF, FACE, BeFoR64
FoBiS.py build -mode stringifor-static-gnu # build static library
Or install directly in one command:
FoBiS.py install szaghi/StringiFor -mode static-gnu
FoBiS.py install szaghi/StringiFor -mode static-gnu --prefix /path/to/prefix
As a project dependency โ declare StringiFor in your fobos and run fetch:
[dependencies]
deps_dir = src/third_party
StringiFor = https://github.com/szaghi/StringiFor
FoBiS.py fetch # fetch and build
FoBiS.py fetch --update # re-fetch and rebuild
fpm
Add to your fpm.toml:
[dependencies]
StringiFor = { git = "https://github.com/szaghi/StringiFor" }
fpm build
fpm test
CMake
cmake -B build && cmake --build build
Makefile
make # static library
make TESTS=yes # build and run tests