---
name: "cs_register_strfunc"
section: "3"
platform: "linux"
package: "clearsilver-dev"
version: "0.10.5-6+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/cs_register_strfunc"
---

# cs\_register\_strfunc(3)

register a string handling function

## NAME

cs\_register\_strfunc  - register a string handling function

## SYNOPSIS

```
#include <cs/cs.h>
```

```
NEOERR *cs_register_strfunc(CSPARSE *parse, char *funcname, CSSTRFUNC str_func);
```

## ARGUMENTS

parse - a pointer to a CSPARSE structure initialized with cs\_init()\
 funcname - the name for the CS function call\
 Note that registering a duplicate funcname will\
 raise a NERR\_DUPLICATE error\
 str\_func - a CSSTRFUNC not-callback

## DESCRIPTION

cs\_register\_strfunc will register a string function that can be called during CS render.  This not-callback is  designed to allow for string formating/escaping functions that are not built-in to CS (since CS is not HTML specific, for instance, but it is very useful to have CS have functions for javascript/html/url escaping).  Note that we explicitly don't provide any associated data or anything to attempt to keep you from using this as a generic callback... The format of a CSSTRFUNC is: NEOERR \* str\_func(char \*in, char \*\*out); This function should not modify the input string, and  should allocate the output string with a libc function. (as we will call free on it)

## SEE ALSO

[**cs\_dump**(3)](/cs_dump/3.md), [**cs\_destroy**(3)](/cs_destroy/3.md), [**cs\_render**(3)](/cs_render/3.md), [**cs\_register\_esc\_strfunc**(3)](/cs_register_esc_strfunc/3.md), **cs\_arg\_parsev**(3), [**cs\_register\_fileload**(3)](/cs_register_fileload/3.md), [**cs\_init**(3)](/cs_init/3.md), [**cs\_register\_strfunc**(3)](/cs_register_strfunc/3.md), **cs\_arg\_parse**(3), [**cs\_parse\_string**(3)](/cs_parse_string/3.md), [**cs\_parse\_file**(3)](/cs_parse_file/3.md), **=**(3), **cs\_register\_function**
