home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hot Shareware 35
/
hot35.iso
/
ficheros
/
LC
/
SEE4C10.ZIP
/
STR.CPP
< prev
next >
Wrap
Text File
|
1998-01-27
|
906b
|
49 lines
// str.cpp
#include <windows.h>
#include "str.h"
// strip trailing CRLF from string
void StripCRLF(LPSTR Buffer)
{int Len;
Len = lstrlen((LPSTR)Buffer);
if(Len<2) return;
if((Buffer[Len-2]=='\r')&&(Buffer[Len-1]=='\n')) Buffer[Len-2] = '\0';
}
// copy string SrcPtr to DstPtr
void StringCopy(LPSTR DstPtr, LPSTR SrcPtr, int MaxSize)
{int i;
for(i=1;i<MaxSize;i++)
{*DstPtr++ = *SrcPtr;
if(*SrcPtr=='\0') break;
SrcPtr++;
}
*DstPtr = '\0';
}
// Find location of character Chr in StringPtr
LPSTR StringChar(LPSTR StringPtr, char Ch)
{
while(1)
{if((*StringPtr)==Ch) return StringPtr;
if((*StringPtr++)=='\0') return NULL;
}
}
// is S2 a left substring of S1 ?
int IsLeftString(LPSTR S1, LPSTR S2)
{char C1, C2;
while(1)
{C1 = *S1++;
C2 = *S2++;
if(C2=='\0') return TRUE;
if(C1!=C2) return FALSE;
}
}