I had a strange Idea while posting that last topic, why don't we make our own string header, that is easy to use, for the sake of it?
Ideas:
+ String class
+ String set/get
+ String copy
+ String get length
Code:
Can someone correct all of that Im on a mac thats not mine, so i can't check it and correct it
Ideas:
+ String class
+ String set/get
+ String copy
+ String get length
Code:
- Code:
// strings2.h Header
class string {
public:
char* contents;
int length;
void set(char* t_char,int t_num)
{
length = t_num;
for(int i=0;i<t_num;i++)
{
contents[i] = t_char[i];
}
}
char* get()
{
return contents;
}
char* get(int t_num)
{
// Get certain amount (from start)
char* t_char;
for(int i=0;i<t_num;i++)
{
t_char[i] = contents[i];
}
return t_char;
}
char* get(int t_start,int t_end)
{
// Get from t_start till t_end
char* t_char;
for(int i=t_start;i<t_end;i++)
{
t_char[i-t_start] = contents[i];
}
return t_char;
}
}
Can someone correct all of that Im on a mac thats not mine, so i can't check it and correct it