Logo Search packages:      
Sourcecode: yate version File versions  Download package

ObjList * String::split ( char  separator,
bool  emptyOK = true 
) const

Splits the string at a delimiter character

separator Character where to split the string
emptyOK True if empty strings should be inserted in list
A newly allocated list of strings, must be deleted after use

Definition at line 726 of file String.cpp.

References TelEngine::ObjList::append(), find(), and String().

    ObjList *list = new ObjList;
    int p = 0;
    int s;
    while ((s = find(separator,p)) >= 0) {
      if (emptyOK || (s > p))
          list->append(new String(m_string+p,s-p));
      p = s + 1;
    if (emptyOK || (m_string && m_string[p]))
      list->append(new String(m_string+p));
    return list;

Generated by  Doxygen 1.6.0   Back to index