PipeWire: String handling

PipeWire 1.6.5

Loading...
Searching...
No Matches
String handling
SPA » Utilities

String handling utilities. More...

## Files
file | string.h
| spa/utils/string.h

## Data Structures
struct | spa_strbuf

## Functions
SPA_API_STRING bool | spa_streq (const char *s1, const char *s2)
SPA_API_STRING bool | spa_strneq (const char *s1, const char *s2, size_t len)
SPA_API_STRING bool | spa_strstartswith (const char *s, const char *prefix)
SPA_API_STRING bool | spa_strendswith (const char *s, const char *suffix)
SPA_API_STRING bool | spa_atoi32 (const char *str, int32_t *val, int base)
| Convert str to an int32_t with the given base and store the result in val.
SPA_API_STRING bool | spa_atou32 (const char *str, uint32_t *val, int base)
| Convert str to an uint32_t with the given base and store the result in val.
SPA_API_STRING bool | spa_atoi64 (const char *str, int64_t *val, int base)
| Convert str to an int64_t with the given base and store the result in val.
SPA_API_STRING bool | spa_atou64 (const char *str, uint64_t *val, int base)
| Convert str to an uint64_t with the given base and store the result in val.
SPA_API_STRING bool | spa_atob (const char *str)
| Convert str to a boolean.
SPA_API_STRING int | spa_vscnprintf (char *buffer, size_t size, const char *format, va_list args)
SPA_API_STRING int | spa_scnprintf (char *buffer, size_t size, const char *format,...)
SPA_API_STRING float | spa_strtof (const char *str, char **endptr)
| Convert str to a float in the C locale.
SPA_API_STRING bool | spa_atof (const char *str, float *val)
| Convert str to a float and store the result in val.
SPA_API_STRING double | spa_strtod (const char *str, char **endptr)
| Convert str to a double in the C locale.
SPA_API_STRING bool | spa_atod (const char *str, double *val)
| Convert str to a double and store the result in val.
SPA_API_STRING char * | spa_dtoa (char *str, size_t size, double val)
SPA_API_STRING void | spa_strbuf_init (struct spa_strbuf *buf, char *buffer, size_t maxsize)
SPA_API_STRING int | spa_strbuf_append (struct spa_strbuf *buf, const char *fmt,...)

## Detailed Description

String handling utilities.

## Function Documentation

## ◆ spa_streq()

SPA_API_STRING bool spa_streq | ( | const char * | s1,
|  | const char * | s2 )

Returns
  true if the two strings are equal, false otherwise

If both a and b are NULL, the two are considered equal.

Examples
  bluez-session.c, local-v4l2.c, spa/examples/adapter-control.c, spa/examples/example-control.c, spa/examples/local-libcamera.c, spa/examples/local-v4l2.c, spa/examples/local-videotestsrc.c, video-play-fixate.c, and video-src-fixate.c.

## ◆ spa_strneq()

SPA_API_STRING bool spa_strneq | ( | const char * | s1,
|  | const char * | s2,
|  | size_t | len )

Returns
  true if the two strings are equal, false otherwise

If both a and b are NULL, the two are considered equal.

## ◆ spa_strstartswith()

SPA_API_STRING bool spa_strstartswith | ( | const char * | s,
|  | const char * | prefix )

Returns
  true if s starts with the prefix or false otherwise. A s is NULL, it never starts with the given prefix. A prefix of NULL is a bug in the caller.

## ◆ spa_strendswith()

SPA_API_STRING bool spa_strendswith | ( | const char * | s,
|  | const char * | suffix )

Returns
  true if s ends with the suffix or false otherwise. A s is NULL, it never ends with the given suffix. A suffix of NULL is a bug in the caller.

## ◆ spa_atoi32()

SPA_API_STRING bool spa_atoi32 | ( | const char * | str,
|  | int32_t * | val,
|  | int | base )

Convert str to an int32_t with the given base and store the result in val.

On failure, the value of val is unmodified.

Returns
  true on success, false otherwise

## ◆ spa_atou32()

SPA_API_STRING bool spa_atou32 | ( | const char * | str,
|  | uint32_t * | val,
|  | int | base )

Convert str to an uint32_t with the given base and store the result in val.

On failure, the value of val is unmodified.

Returns
  true on success, false otherwise

## ◆ spa_atoi64()

SPA_API_STRING bool spa_atoi64 | ( | const char * | str,
|  | int64_t * | val,
|  | int | base )

Convert str to an int64_t with the given base and store the result in val.

On failure, the value of val is unmodified.

Returns
  true on success, false otherwise

## ◆ spa_atou64()

SPA_API_STRING bool spa_atou64 | ( | const char * | str,
|  | uint64_t * | val,
|  | int | base )

Convert str to an uint64_t with the given base and store the result in val.

On failure, the value of val is unmodified.

Returns
  true on success, false otherwise

## ◆ spa_atob()

SPA_API_STRING bool spa_atob | ( | const char * | str | ) |

Convert str to a boolean.

Allowed boolean values are "true" and a literal "1", anything else is false.

Returns
  true on success, false otherwise

## ◆ spa_vscnprintf()

SPA_API_STRING int spa_vscnprintf | ( | char * | buffer,
|  | size_t | size,
|  | const char * | format,
|  | va_list | args )

## ◆ spa_scnprintf()

SPA_API_STRING int spa_scnprintf | ( | char * | buffer,
|  | size_t | size,
|  | const char * | format,
|  |  | ... )

## ◆ spa_strtof()

SPA_API_STRING float spa_strtof | ( | const char * | str,
|  | char ** | endptr )

Convert str to a float in the C locale.

If endptr is not NULL, a pointer to the character after the last character used in the conversion is stored in the location referenced by endptr.

Returns
  the result float.

## ◆ spa_atof()

SPA_API_STRING bool spa_atof | ( | const char * | str,
|  | float * | val )

Convert str to a float and store the result in val.

On failure, the value of val is unmodified.

Returns
  true on success, false otherwise

## ◆ spa_strtod()

SPA_API_STRING double spa_strtod | ( | const char * | str,
|  | char ** | endptr )

Convert str to a double in the C locale.

If endptr is not NULL, a pointer to the character after the last character used in the conversion is stored in the location referenced by endptr.

Returns
  the result float.

## ◆ spa_atod()

SPA_API_STRING bool spa_atod | ( | const char * | str,
|  | double * | val )

Convert str to a double and store the result in val.

On failure, the value of val is unmodified.

Returns
  true on success, false otherwise

## ◆ spa_dtoa()

SPA_API_STRING char * spa_dtoa | ( | char * | str,
|  | size_t | size,
|  | double | val )

## ◆ spa_strbuf_init()

SPA_API_STRING void spa_strbuf_init | ( | struct spa_strbuf * | buf,
|  | char * | buffer,
|  | size_t | maxsize )

## ◆ spa_strbuf_append()

SPA_API_STRING int spa_strbuf_append | ( | struct spa_strbuf * | buf,
|  | const char * | fmt,
|  |  | ... )