Rev 4718 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4718 | Rev 4870 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | #include "..\lib\kolibri.h" |
2 | #include "..\lib\kolibri.h" |
3 | #include "..\lib\strings.h" |
3 | #include "..\lib\strings.h" |
4 | #include "..\lib\mem.h" |
4 | #include "..\lib\mem.h" |
5 | #include "..\lib\file_system.h" |
5 | #include "..\lib\file_system.h" |
Line 6... | Line -... | ||
6 | - | ||
7 | void str_replace(dword buf_in, what_replace, to_what_replace) { |
- | |
8 | dword start_pos=0; |
- | |
9 | dword buf_from; |
- | |
10 | - | ||
11 | buf_from = malloc(strlen(buf_in)); |
- | |
12 | loop() { |
- | |
13 | strcpy(buf_from, buf_in); |
- | |
14 | start_pos = strstr(buf_from, what_replace); |
- | |
15 | if (start_pos == 0) break; |
- | |
16 | strlcpy(buf_in, buf_from, start_pos-buf_from); |
- | |
17 | strcat(buf_in, to_what_replace); |
- | |
18 | start_pos += strlen(what_replace); |
- | |
19 | strcat(buf_in, start_pos); |
- | |
20 | } |
- | |
21 | free(buf_from); |
- | |
22 | } |
- | |
23 | 6 | ||
24 | void main() |
7 | void main() |
25 | { |
8 | { |
26 | int id, key; |
- | |
27 | strcpy(#param, " lorem"); |
- | |
28 | str_replace(#param, "<", "<"); |
- | |
Line 29... | Line 9... | ||
29 | str_replace(#param, ">", ">"); |
9 | int id, key; |
30 | 10 | ||
31 | loop() |
11 | loop() |
32 | { |
12 | { |