LAL  7.5.0.1-08ee4f4

Detailed Description

Creation/destruction/manipulation API for LALStringVector objects, which are just LAL-type vectors of CHAR * pointers.

Author
Reinhard Prix
Date
2008

Synopsis

#include <lal/StringVector.h>

Prototypes

LALStringVectorXLALCreateStringVector (const CHAR *str1,...)
 Create a StringVector from the list of strings passed as arguments. More...
 
LALStringVectorXLALCreateEmptyStringVector (UINT4 length)
 Create an empty string vector of the given length. More...
 
LALStringVectorXLALCopyStringVector (const LALStringVector *vect)
 Create a copy of a string vector. More...
 
LALStringVectorXLALAppendString2Vector (LALStringVector *vect, const CHAR *string)
 Append the given string to the string-vector (XLAL interface), return pointer to the resulting string-vector, or NULL on error. More...
 
void XLALDestroyStringVector (LALStringVector *vect)
 XLAL-interface: Free a string-vector ;) More...
 
char * XLALConcatStringVector (const LALStringVector *strings, const char *sep)
 Concatenate a string vector 'strings', separated by the string 'sep', into a single string. More...
 
LALStringVectorXLALParseStringVector (const char *string, const char *delim)
 Parse 'string' into a string vector of tokens, delimited by the characters 'delim'. More...
 
int XLALSortStringVector (LALStringVector *strings)
 Sort string-vector alphabetically in place More...
 
INT4 XLALFindStringInVector (const char *needle, const LALStringVector *haystack)
 Search for string 'needle' in string-vector 'haystack', return index to first matching vector element if found, -1 outherwise. More...
 
char * XLALDeblankString (const char *start, UINT4 len)
 Copy (and allocate) string from 'start' with length 'len', removing all starting- and trailing blanks! More...
 

Files

file  StringVectorTest.c
 

Function Documentation

◆ XLALCreateStringVector()

LALStringVector* XLALCreateStringVector ( const CHAR str1,
  ... 
)

Create a StringVector from the list of strings passed as arguments.

Note
All arguments MUST be CHAR* strings. The last argument MUST be NULL, as C cannot deduce the number of arguments otherwise.

Definition at line 100 of file StringVector.c.

◆ XLALCreateEmptyStringVector()

LALStringVector* XLALCreateEmptyStringVector ( UINT4  length)

Create an empty string vector of the given length.

Definition at line 164 of file StringVector.c.

◆ XLALCopyStringVector()

LALStringVector* XLALCopyStringVector ( const LALStringVector vect)

Create a copy of a string vector.

Definition at line 189 of file StringVector.c.

◆ XLALAppendString2Vector()

LALStringVector* XLALAppendString2Vector ( LALStringVector vect,
const CHAR string 
)

Append the given string to the string-vector (XLAL interface), return pointer to the resulting string-vector, or NULL on error.

Note
It is allowed to pass NULL as the input string-vector 'vect', which corresponds to creating a new string-vector with a single element 'string'
Parameters
vectinput string-vector to append to
stringstring to append

Definition at line 47 of file StringVector.c.

◆ XLALDestroyStringVector()

void XLALDestroyStringVector ( LALStringVector vect)

XLAL-interface: Free a string-vector ;)

Definition at line 204 of file StringVector.c.

◆ XLALConcatStringVector()

char* XLALConcatStringVector ( const LALStringVector strings,
const char *  sep 
)

Concatenate a string vector 'strings', separated by the string 'sep', into a single string.

Definition at line 246 of file StringVector.c.

◆ XLALParseStringVector()

LALStringVector* XLALParseStringVector ( const char *  string,
const char *  delim 
)

Parse 'string' into a string vector of tokens, delimited by the characters 'delim'.

Definition at line 280 of file StringVector.c.

◆ XLALSortStringVector()

int XLALSortStringVector ( LALStringVector strings)

Sort string-vector alphabetically in place

Definition at line 312 of file StringVector.c.

◆ XLALFindStringInVector()

INT4 XLALFindStringInVector ( const char *  needle,
const LALStringVector haystack 
)

Search for string 'needle' in string-vector 'haystack', return index to first matching vector element if found, -1 outherwise.

Note: function allows haystack=NULL input, in which case -1 (=not found) will be returned.

Definition at line 370 of file StringVector.c.

◆ XLALDeblankString()

char* XLALDeblankString ( const char *  start,
UINT4  len 
)

Copy (and allocate) string from 'start' with length 'len', removing all starting- and trailing blanks!

Definition at line 330 of file StringVector.c.