[Include] "stringh.inc": Implementing useful functions from C's "string.h"
#18

What's wrong with NULL terminating a string and use strcat to make it look like strcpy. I've actually tested this macro...

Edit:
pawn Код:
new buffer[128] = "";
__strcat_(buffer, "Test __strcat_");
print(buffer);
strncat(buffer, "Test strncat", 12);
print(buffer);
printf("First 's' at %d", strchr(buffer, 's'));
printf("Last 's' at %d", strrchr(buffer, 's'));
printf("__strcmp_ result: %d", __strcmp_("foo", "Foo"));
printf("strncmp result: %d", strncmp("foo", "Foo", 2));
printf("strcasecmp result: %d", strcmp("foo", "Foo"));
printf("strncasecmp result: %d", strncasecmp("foo", "Foo", 2));
strcpy(buffer, "Test strcpy");
print(buffer);
strncpy(buffer, "Test strncpy", 12);
print(buffer);
print(strpbrk(buffer, {'s', 't', 'c'}));
printf("strspn %d", strspn(buffer, {'s', 't', 'c'}));
printf("strspn %d", strcspn(buffer, {'s', 't', 'c'}));
printf("strstr %d", strstr(buffer, "Test"));
printf("strcasestr %d", strstr(buffer, "Test"));
Код:
[22:45:40] Test __strcat_
[22:45:40] Test strncat
[22:45:40] First 's' at 3
[22:45:40] Last 's' at 6
[22:45:40] __strcmp_ result: 1
[22:45:40] strncmp result: 1
[22:45:40] strcasecmp result: 1
[22:45:40] strncasecmp result: 0
[22:45:40] Test strcpy
[22:45:40] Test strncpy
[22:45:40] ssttcssttrsspn 
[22:45:40] strspn 9
[22:45:40] strspn 3
[22:45:40] strstr 0
[22:45:40] strcasestr 0
Reply


Messages In This Thread
"stringh.inc": Implementing useful functions from C's "string.h" - by Aeonosphere - 18.05.2013, 01:22
Re: "stringh.inc": Implementing useful functions from C's "string.h" - by RajatPawar - 18.05.2013, 04:37
Re: "stringh.inc": Implementing useful functions from C's "string.h" - by Niko_boy - 18.05.2013, 06:53
Re: "stringh.inc": Implementing useful functions from C's "string.h" - by Aeonosphere - 18.05.2013, 07:55
AW: "stringh.inc": Implementing useful functions from C's "string.h" - by BigETI - 18.05.2013, 08:01
Re: "stringh.inc": Implementing useful functions from C's "string.h" - by Emmet_ - 18.05.2013, 08:02
AW: Re: "stringh.inc": Implementing useful functions from C's "string.h" - by BigETI - 18.05.2013, 08:12
Re: AW: Re: "stringh.inc": Implementing useful functions from C's "string.h" - by Aeonosphere - 18.05.2013, 08:15
Re: AW: Re: "stringh.inc": Implementing useful functions from C's "string.h" - by Emmet_ - 18.05.2013, 08:17
Re: AW: Re: "stringh.inc": Implementing useful functions from C's "string.h" - by Aeonosphere - 18.05.2013, 08:23
Re: AW: Re: "stringh.inc": Implementing useful functions from C's "string.h" - by Emmet_ - 18.05.2013, 08:31
Re: "stringh.inc": Implementing useful functions from C's "string.h" - by Aeonosphere - 18.05.2013, 08:46
AW: "stringh.inc": Implementing useful functions from C's "string.h" - by BigETI - 18.05.2013, 10:04
Re: AW: "stringh.inc": Implementing useful functions from C's "string.h" - by Aeonosphere - 18.05.2013, 11:10
AW: "stringh.inc": Implementing useful functions from C's "string.h" - by BigETI - 18.05.2013, 14:50
AW: Re: "stringh.inc": Implementing useful functions from C's "string.h" - by BigETI - 18.05.2013, 20:06
AW: "stringh.inc": Implementing useful functions from C's "string.h" - by BigETI - 18.05.2013, 20:23
AW: "stringh.inc": Implementing useful functions from C's "string.h" - by BigETI - 18.05.2013, 20:43
AW: "stringh.inc": Implementing useful functions from C's "string.h" - by BigETI - 18.05.2013, 21:55
AW: "stringh.inc": Implementing useful functions from C's "string.h" - by BigETI - 18.05.2013, 22:35

Forum Jump:


Users browsing this thread: 4 Guest(s)