blob: a291881500071987d245c0dca7ae31635e4d333a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/* -------------------------------------------
Copyright Amlal EL Mahrouss.
Purpose: DDK Strings.
------------------------------------------- */
#include <DDKKit/str.h>
DDK_EXTERN size_t kstrlen(const char* in)
{
if (in == nil)
return 0;
if (*in == 0)
return 0;
size_t index = 0;
while (in[index] != 0)
{
++index;
}
return index;
}
DDK_EXTERN int kstrncpy(char* dst, const char* src, size_t len)
{
size_t index = 0;
while (index != len)
{
dst[index] = src[index];
++index;
}
return index;
}
|