diff options
Diffstat (limited to 'src/fstring.h')
-rw-r--r-- | src/fstring.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/fstring.h b/src/fstring.h index 666480c..82e8b34 100644 --- a/src/fstring.h +++ b/src/fstring.h | |||
@@ -731,6 +731,39 @@ namespace Bu | |||
731 | } | 731 | } |
732 | return -1; | 732 | return -1; |
733 | } | 733 | } |
734 | |||
735 | /** | ||
736 | * Find the index of the first occurrance of cChar | ||
737 | *@param sText (const chr *) The string to search for. | ||
738 | *@returns (long) The index of the first occurrance. -1 for not found. | ||
739 | */ | ||
740 | long find( long iStart, const chr cChar ) const | ||
741 | { | ||
742 | flatten(); | ||
743 | for( long j = iStart; j < pFirst->nLength; j++ ) | ||
744 | { | ||
745 | if( pFirst->pData[j] == cChar ) | ||
746 | return j; | ||
747 | } | ||
748 | return -1; | ||
749 | } | ||
750 | |||
751 | /** | ||
752 | * Find the index of the first occurrance of sText | ||
753 | *@param cChar (const chr) The character to search for. | ||
754 | *@returns (long) The index of the first occurrance. -1 for not found. | ||
755 | */ | ||
756 | long find( long iStart, const chr *sText ) const | ||
757 | { | ||
758 | long nTLen = strlen( sText ); | ||
759 | flatten(); | ||
760 | for( long j = iStart; j < pFirst->nLength-nTLen; j++ ) | ||
761 | { | ||
762 | if( !strncmp( sText, pFirst->pData+j, nTLen ) ) | ||
763 | return j; | ||
764 | } | ||
765 | return -1; | ||
766 | } | ||
734 | 767 | ||
735 | /** | 768 | /** |
736 | * Do a reverse search for (sText) | 769 | * Do a reverse search for (sText) |