Пример #1
0
inline int findString( CharString & sText, int nCurPos, const CharString & sSearch, RegExpM * cr, bool bUseCr )
{
	if( bUseCr )
		return cr->regFind( sText.buffer() + nCurPos );
	else
	{
		int nAbsolutePos = sText.find( sSearch, nCurPos);
		if( nAbsolutePos > 0 )
			nAbsolutePos -= nCurPos;	// absolute -> relative

		return nAbsolutePos;
	}
}
Пример #2
0
inline int findMatchingLine( CharString & sText, int nPosition, CharString & sLine )
{
	int startPos = sText.reverseFind('\n',nPosition);	// left linebreak
	if( startPos > 0 )
		startPos++;		// Skip linebreak

	int endPos = sText.find( '\n', nPosition );				// right linebreak
	if( endPos < 0 )
		endPos = startPos+sText.length() - 1;

	sLine = sText.copy(sText);
	sLine.mid( startPos, ( endPos - startPos ) + 1 );

	return endPos + 1;
}