This returns the position of the last instance of c in str. The comparison is case insensitive
| Return Type | Function name | Arguments |
|---|---|---|
| int32_t | CstrLastI | (const char*,char,) |
Declared in file: hzTextproc.h
Defined in file : hzTextproc.cpp
Function Logic:
Function body:
int32_t CstrLastI (const char* cpStr)char testChar,
{
// Category: Text Processing
//
// This returns the position of the last instance of c in str. The comparison is case insensitive
//
// Arguments: 1) cpStr The source string
// 2) testChar The char to test for
//
// Returns: -1 If the test char does not appear in the string
// 0+ Being the position of the last occurence of the test char in the string
int32_t nPosn = 0; // Input string position
int32_t nLast = -1; // Last position found
if (!cpStr || !cpStr[0]|| !testChar)
return -1;
for (nPosn = 0; cpStr[nPosn] ; nPosn++)
{
if (cpStr[nPosn] == testChar)
nLast = nPosn ;
}
return nLast ;
}