Ejemplo n.º 1
0
bool str::erase(const char* pString)
{
    const int findIndex = firstIndexOf(pString);
    if(mInvalidIndex != findIndex)
    {
        return eraseAfter(findIndex, strlen(pString));
    }
    return false;
}
Ejemplo n.º 2
0
// Calls function: subString(int fromIndex, int charCount)
const str& str::subString(char fromFirstChar, char toLastChar)
{
    const char fi[] = {fromFirstChar, 0x00};
    const char li[] = {toLastChar, 0x00};
    const int firstIndex = firstIndexOf(fi);
    const int lastIndex  =  lastIndexOf(li);

    return subString(firstIndex, lastIndex - firstIndex + 1);
}
void _NativeFrameworkDSString::replace(char *_string, char *withString){
	while(contains(_string)){
		int startIndex = firstIndexOf(_string);
		int endIndex = startIndex + ((string(_string)).length() -1);

		string firstPart = substring(0, startIndex);
		string secondPart = substring(endIndex+1, length());

		variableString = firstPart + string(withString) + secondPart;
	}
}
Ejemplo n.º 4
0
bool str::replaceFirst(const char* pFind, const char* pWith)
{
    const int findIndex = firstIndexOf(pFind);
    if(findIndex != mInvalidIndex)
    {
        eraseAfter(findIndex, strlen(pFind));
        insertAt(findIndex, pWith);
        return true;
    }
    return false;
}
Ejemplo n.º 5
0
int str::replaceAll(const char* pFind, const char* pWith)
{
    int count = 0;
    int findIndex = mInvalidIndex;

    while(mInvalidIndex != (findIndex = firstIndexOf(pFind)))
    {
        eraseAfter(findIndex, strlen(pFind));
        insertAt(findIndex, pWith);
        ++count;
    }

    return count;
}
int _NativeFrameworkDSString::indexOf(_NativeFrameworkDSString ch){
	return firstIndexOf(ch);
}
bool _NativeFrameworkDSString::contains(_NativeFrameworkDSString testString){
	if(firstIndexOf(testString) != -1) return true;
	return false;
}
bool _NativeFrameworkDSString::contains(char character){
	if(firstIndexOf(character) != -1) return true;
	return false;
}
Ejemplo n.º 9
0
// Calls subString(int fromIndex, int charCount);
const str& str::subString(const char* fromStr, int charCount)
{
    return subString(firstIndexOf(fromStr), charCount);
}
Ejemplo n.º 10
0
// Calls function: subString(int fromIndex)
const str& str::subString(const char* fromStr)
{
    return subString(firstIndexOf(fromStr));
}
Ejemplo n.º 11
0
bool str::contains(const char* pString) const
{
    return firstIndexOf(pString) != mInvalidIndex;
}