Mercurial
annotate dowa/d_string.c @ 68:70ca1d99f3fd
Mimicing what tsoding did for his video. Kinda cool.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Thu, 25 Dec 2025 20:03:51 -0800 |
| parents | fff1b048dda6 |
| children | 75de5903355c |
| rev | line source |
|---|---|
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1 #include "dowa.h" |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2 |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3 char *Dowa_Int32ToString(uint32 int32, char *buffer) |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4 { |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5 sprintf(buffer, "%d", int32); |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6 return buffer; |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
7 } |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
8 |
|
63
fff1b048dda6
[Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
9 const char *Dowa_String_Slice(const char *from, size_t start, size_t end) |
|
fff1b048dda6
[Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
10 { |
|
fff1b048dda6
[Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
11 static char buffer[1024] = {0}; |
|
fff1b048dda6
[Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
12 size_t buffer_pos = 0; |
|
fff1b048dda6
[Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
13 for (int i = start; start < strlen(from) || start < end; i++) |
|
fff1b048dda6
[Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
14 { |
|
fff1b048dda6
[Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
15 buffer[buffer_pos++] = from[i]; |
|
fff1b048dda6
[Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
16 } |
|
fff1b048dda6
[Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
17 return buffer; |
|
fff1b048dda6
[Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
18 } |
|
fff1b048dda6
[Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
19 |
|
fff1b048dda6
[Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
20 |
|
fff1b048dda6
[Postdog] Fixed a problem where string did not wrap.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
21 |