| IDA SDK

Modules | Classes | Functions
Functions: strings

## Detailed Description

functions that manipulate strings

## Modules
| line cleanup flags
| Passed as 'flags' parameter to qcleanline()
| Functions: string conversion
| functions that convert between string encodings

## Classes
struct | strarray_t
| Map strings to integer values - see strarray() More...

## Functions
idaman THREAD_SAFE char *ida_export | add_spaces (char *str, size_t bufsize, ssize_t len)
| Add space characters to the colored string so that its length will be at least 'len' characters. More...
idaman THREAD_SAFE char *ida_export | trim (char *str)
| Remove trailing space characters from a string. More...
idaman THREAD_SAFE const char *ida_export | skip_spaces (const char *ptr)
| Skip whitespaces in the string. More...
char * | skip_spaces (char *ptr)
idaman THREAD_SAFE ssize_t ida_export | qcleanline (qstring *buf, char cmt_char='\0', uint32 flags=CLNL_TRIM|CLNL_FINDCMT)
| Performs some cleanup operations to a line. More...
idaman THREAD_SAFE const char *ida_export | strarray (const strarray_t *array, size_t array_size, int code)
| Find a line with the specified code in the strarray_t array. More...
idaman size_t ida_export | ea2str (char *buf, size_t bufsize, ea_t ea)
| Convert linear address to UTF-8 string.

## Function Documentation

## ◆ add_spaces()

idaman THREAD_SAFE char *ida_export add_spaces | ( | char * | str,
|  | size_t | bufsize,
|  | ssize_t | len
| ) |  |

Add space characters to the colored string so that its length will be at least 'len' characters.

Don't trim the string if it is longer than 'len'.

Parameters

  str | pointer to colored string to modify (may not be nullptr)
  bufsize | size of the buffer with the string
  len | the desired length of the string

Returns
  pointer to the end of input string

## ◆ trim()

idaman THREAD_SAFE char *ida_export trim | ( | char * | str | ) |

Remove trailing space characters from a string.

Parameters

  str | pointer to string to modify (may be nullptr)

Returns
  pointer to input string

## ◆ skip_spaces() [1/2]

idaman THREAD_SAFE const char *ida_export skip_spaces | ( | const char * | ptr | ) |

Skip whitespaces in the string.

Returns
  pointer to first non-whitespace char in given string

## ◆ skip_spaces() [2/2]

char * skip_spaces | ( | char * | ptr | ) |
| inline

Parameters

  ptr |

Returns
  pointer to first non-whitespace char in given string

## ◆ qcleanline()

idaman THREAD_SAFE ssize_t ida_export qcleanline | ( | qstring * | buf,
|  | char | cmt_char = `'\0'`,
|  | uint32 | flags = `CLNL_TRIM|CLNL_FINDCMT`
| ) |  |

Performs some cleanup operations to a line.

Parameters

  buf | string to modify
  cmt_char | character that denotes the start of a comment: the entire text is removed if the line begins with this character (ignoring leading spaces) all text after (and including) this character is removed if flag CLNL_FINDCMT is set
  flags | a combination of line cleanup flags. defaults to CLNL_TRIM

Returns
  length of line

## ◆ strarray()

idaman THREAD_SAFE const char *ida_export strarray | ( | const strarray_t * | array,
|  | size_t | array_size,
|  | int | code
| ) |  |

Find a line with the specified code in the strarray_t array.

If the last element of the array has code==0 then it is considered as the default entry.
If no default entry exists and the code is not found, strarray() returns "".