Skip to content

Commit

Permalink
count
Browse files Browse the repository at this point in the history
  • Loading branch information
wildwoong@gmail.com committed Jan 24, 2011
1 parent 212e417 commit 757a03f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions String.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// String.cpp

#include <string>
using namespace std;

#include "String.h"

String::String(int capacity)
Expand Down Expand Up @@ -93,10 +90,9 @@ int String::Append(char ch)
return this->length;
}

int String::Append(char* pstr)
int String::Append(char* pstr, int count)
{
int i;
int count = strlen(pstr);

if(this->length >= this->capacity-1)
{
Expand Down Expand Up @@ -161,16 +157,15 @@ int String::Insert(int index, char ch)
return index;
}

int String::Insert(int index, char* pstr)
int String::Insert(int index, char* pstr, int count)
{
int i;
int count = strlen(pstr);

if(this->length < this->capacity-1)
{
for(i = this->length+strlen(pstr); i > index; i--)
for(i = this->length+count; i > index; i--)
{
this->front[i] = this->front[i-strlen(pstr)];
this->front[i] = this->front[i-count];
}
}
else
Expand Down

0 comments on commit 757a03f

Please sign in to comment.