sdk-hwV1.3/external/eyesee-mpp/framework/sun8iw21/demo/cdrPlayerDemo/utils/stringOperate.cpp

63 lines
1.2 KiB
C++
Raw Normal View History

2024-05-07 10:09:20 +00:00
/*
********************************************************************************
* Android multimedia module
*
* (c) Copyright 2010-2015, Allwinner Microelectronic Co., Ltd.
* All Rights Reserved
*
* File : stringOperate.cpp
* Version: V1.0
* By : eric_wang
* Date : 2015-7-13
* Description:
********************************************************************************
*/
#include "stringOperate.h"
#include <string.h>
using namespace std;
namespace EyeseeLinux {
int removeCharFromCString(char *pString, char c)
{
int length = strlen(pString);
int i, j;
for(i=0;i<length;i++)
{
if(pString[i] == c)
{
pString[i] = '\0';
for(j=i+1;j<length;j++)
{
pString[j-1] = pString[j];
}
i--;
length--;
}
}
return (int)strlen(pString);
}
int removeCharFromString(string& nString, char c)
{
string::size_type pos;
while(1)
{
pos = nString.find(c);
if(pos != string::npos)
{
nString.erase(pos, 1);
}
else
{
break;
}
}
return (int)nString.size();
}
};