PetscOptionsStringToBool — PETSc 3.25.4 documentation

Skip to main content
`Ctrl`+`K`

# PetscOptionsStringToBool

Converts a string to a `PetscBool`

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscOptionsStringToBool(const char value[], PetscBool *a)

Not Collective

## Input Parameter

- value - the string to convert; may be `NULL` or `""`

## Output Parameter

- a - the resulting `PetscBool`

## Note

Recognizes (case-insensitive) `TRUE`, `YES`, `1`, `on` as `PETSC_TRUE` and `FALSE`, `NO`, `0`, `off` as `PETSC_FALSE`. An empty or `NULL` string is treated as `PETSC_TRUE`. Any other input generates an error.

## See Also

`PetscOptionsStringToInt()`, `PetscOptionsStringToReal()`, `PetscOptionsStringToScalar()`, `PetscOptionsGetBool()`

## Level

developer

## Location

src/sys/objects/options.c

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages