String-related
[Functions]

Some of these functions are similar to <string.h> functions, with the exception that they also accept NULL pointers as empty strings (""), and use operator new instead of malloc(). More...

Functions

int opp_strlen (const char *)
char * opp_strdup (const char *)
char * opp_strcpy (char *, const char *)
int opp_strcmp (const char *, const char *)
SIM_API char * opp_strprettytrunc (char *dest, const char *src, unsigned maxlen)

Detailed Description

Some of these functions are similar to <string.h> functions, with the exception that they also accept NULL pointers as empty strings (""), and use operator new instead of malloc().

It is recommended to use these functions instead of the original <string.h> functions.


Function Documentation

char * opp_strdup ( const char *  s  )  [inline]

Duplicates the string, using new char[].

For NULLs and empty strings it returns NULL.

Referenced by opp_string::operator=(), and opp_string::opp_string().

SIM_API char* opp_strprettytrunc ( char *  dest,
const char *  src,
unsigned  maxlen 
)

Copies src string into desc, and if its length would exceed maxlen, it is truncated with an ellipsis.

For example, opp_strprettytrunc(buf, "long-long",6) yields "lon...".

Generated on Tue Dec 2 11:16:28 2014 for OMNeT++ Simulation Library by  doxygen 1.6.3