Appearance
The tutorial
The tutorial teaches StringiFor by building one program, step by step. The cookbook then collects short recipes for everyday tasks, and the reference has every method and every argument.
The chapters
The tutorial builds report, a program that reads a small table of cars from a CSV file and prints a report: from a first string to a file read, cleaned, computed and laid out. Each chapter is a complete program that you can compile and run; every output shown is the real output of that program.
| Chapter | You learn |
|---|---|
| 1. A first string | the string type; assignment, printing, // and .cat., comparisons |
| 2. Cleaning and transforming | strip, replace, unique, compact, squeeze, transliterate, upper and lower case, word-level case styles |
| 3. Splitting and joining | split (also keeping the empty fields), join, partition; start_with, end_with, index, count; a method on a whole array |
| 4. Numbers | is_number, is_integer, is_real, to_number, read_number, numbers assigned to strings, hex |
| 5. Files and paths | read_file, write_file, basedir, basename, extension, match |
| 6. A polished report | ljust, rjust, slice, justify, colorize |
The cookbook
The cookbook answers "how do I ...?" in a few lines each: split a line into words, read a whole file, check whether a string is a number, compare two versions, ...
Building the examples
Every program of the tutorial and of the cookbook is in docs/examples/src. With StringiFor built by FoBiS (fobis build --mode stringifor-static-gnu, see Installation):
bash
gfortran -I lib/mod docs/examples/src/report_1.f90 lib/libstringifor.a -o report
./reportbash scripts/docs_examples.sh builds and runs all of them, regenerating the outputs shown in these pages. The programs that read a file expect the ones of docs/examples/files in the current directory.