diff options
author | Mike Buland <eichlan@xagasoft.com> | 2008-09-24 03:45:46 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2008-09-24 03:45:46 +0000 |
commit | 5aec71241c874a2249c14025a7df1eddc1c14654 (patch) | |
tree | f719e6b64bb3af39d312ba526cdf6706c2c65c06 /src/fstring.h | |
parent | 0975d66d2f06603f5e4016440b333aac88e2958a (diff) | |
download | libbu++-5aec71241c874a2249c14025a7df1eddc1c14654.tar.gz libbu++-5aec71241c874a2249c14025a7df1eddc1c14654.tar.bz2 libbu++-5aec71241c874a2249c14025a7df1eddc1c14654.tar.xz libbu++-5aec71241c874a2249c14025a7df1eddc1c14654.zip |
Added a getSubStr function to Bu::FString, and more tests to the fstring unit
test.
Diffstat (limited to '')
-rw-r--r-- | src/fstring.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/fstring.h b/src/fstring.h index b4cae3a..620b312 100644 --- a/src/fstring.h +++ b/src/fstring.h | |||
@@ -390,6 +390,24 @@ namespace Bu | |||
390 | return pFirst->pData; | 390 | return pFirst->pData; |
391 | } | 391 | } |
392 | 392 | ||
393 | MyType getSubStr( long iStart, long iSize=-1 ) const | ||
394 | { | ||
395 | if( iStart < 0 ) | ||
396 | iStart = 0; | ||
397 | if( iStart >= nLength ) | ||
398 | return ""; | ||
399 | if( iSize < 0 ) | ||
400 | iSize = nLength; | ||
401 | if( iStart+iSize > nLength ) | ||
402 | iSize = nLength-iStart; | ||
403 | if( iSize == 0 ) | ||
404 | return ""; | ||
405 | |||
406 | flatten(); | ||
407 | MyType ret( pFirst->pData+iStart, iSize ); | ||
408 | return ret; | ||
409 | } | ||
410 | |||
393 | /** | 411 | /** |
394 | * (std::string compatability) Get a pointer to the string array. | 412 | * (std::string compatability) Get a pointer to the string array. |
395 | *@returns (chr *) The string data. | 413 | *@returns (chr *) The string data. |