Logo Search packages:      
Sourcecode: osb-jscore version File versions  Download package

UString KJS::UString::substr ( int  pos = 0,
int  len = -1 
) const

Returns:
The sub string starting at position pos and length len.

Definition at line 1057 of file ustring.cpp.

References KJS::UString::Rep::deref(), and size().

{
  if (pos < 0)
    pos = 0;
  else if (pos >= (int) size())
    pos = size();
  if (len < 0)
    len = size();
  if (pos + len >= (int) size())
    len = size() - pos;

  UString::Rep *newRep = Rep::create(rep, pos, len);
  UString result(newRep);
  newRep->deref();

  return result;
}


Generated by  Doxygen 1.6.0   Back to index