示例#1
0
void festring::ExtractWord(festring& To)
{
    for(sizetype c = 0; c < Size; ++c)
        if(Data[c] == ' ')
        {
            To.Empty();
            To.Append(&Data[c + 1], Size - c - 1);
            Erase(c, Size - c);
            SwapData(To);
            return;
        }

    To = *this;
    Empty();
}
示例#2
0
void festring::SplitString(festring& Source,
                           festring& Result,
                           sizetype Length)
{
    if(Source.GetSize() <= Length)
    {
        Result << Source;
        Source.Empty();
        return;
    }

    sizetype Pos = Source.FindLast(' ', Length);

    if(Pos != NPos)
    {
        Result.Append(Source, Pos);
        Source.Erase(0, Pos + 1);
    }
    else
    {
        Result.Append(Source, Length);
        Source.Erase(0, Length);
    }
}