---
name: "clig_String"
section: "7"
platform: "linux"
package: "clig"
version: "1.9.11.1-3"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/clig_String"
---

# clig\_String(7)

declare an option with parameters of type string

## NAME

::clig::String - declare an option with parameters of type string

## SYNOPSIS

```
package require clig
namespace import ::clig::*
setSpec db
```

**String -***opt varname usage* \[**-c** *min max*\] {\[**-d** *default ...*\] \| \[**-m**\]}

## DESCRIPTION

The **String** command declares *-opt* to have zero or more string arguments.

- varname

  declares that arguments found for  *-opt* are passed to the caller of the parser in a variable (tcl) or slot (C)  of that name.

- usage

  is a short text describing  *-opt*. It is used in the generated manual or in a usage-message printed by the parser if necessary.

- \-c

  specifies the minimum and maximum number of parameters *-opt* may have. If less than *min* or more than *max* are found, the  parser prints an error message to stderr and terminates the calling process.  Use *min*==*max* to request exactly so many arguments. As a special value for **max**, **oo** is understood as positive infinity.

- \-d

  stores a (list of) default value(s) for option *-opt*. The parser pretends these were found on the command line, if option *-opt* is not given. \
   **WARNING:** The number of default values is not checked against the minimum and maximum values given for  **-c**.

- \-m

  declares that *-opt* is mandatory. Put another way, the \`\`option'' is not really optional but must show up on the command line. If it does not, the parser prints an error message to stderr and exits the calling process. This can not be used together with  **-d**.

## PARSER RESULT

### tcl

Within a Tcl-script, the parser will set the variable with name *varname* in the stack-frame of its caller if and only if option *-opt* is found on the command line or has a default value.

### C

The structure returned by the parser contains the slots *varname***P**, *varname* and *varname***C**.  The slot *varname***P** will be set to a non-zero value, if and only if the option *-opt* is found on the command line or has a default value. Otherwise it will  be 0. The slot *varname***C** will be set to the number of arguments found for *-opt*. If the number of arguments for *-opt* is allowed to be greater than 1, slot *varname* has type **char\*\***, otherwise it has type **char\***.

## SEE ALSO

[clig\_Name(7)](/clig_Name/7.md), [clig\_Double(7)](/clig_Double/7.md), [clig(1)](/clig/1.md), [clig\_Usage(7)](/clig_Usage/7.md), [clig\_Long(7)](/clig_Long/7.md), [clig\_Version(7)](/clig_Version/7.md), [clig\_Float(7)](/clig_Float/7.md), [clig\_Rest(7)](/clig_Rest/7.md), [clig\_Description(7)](/clig_Description/7.md), [clig\_Flag(7)](/clig_Flag/7.md), [clig\_Commandline(7)](/clig_Commandline/7.md), [clig\_parseCmdline(7)](/clig_parseCmdline/7.md), [clig\_Int(7)](/clig_Int/7.md)
