Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
string.qh
Go to the documentation of this file.
1#pragma once
2
3#include "nil.qh"
4#include "sort.qh"
5#include "oo.qh"
6
7// this is not exactly 16KiB (16384 bytes) because one byte is reserved for the \0 terminator
8#define VM_TEMPSTRING_MAXSIZE 16383
9
10// string logic
11//
12// true: is truthy
13// == "": is equal to ""
14// is "": has the same string index as the string constant ""
15// strunzone: can be strunzoned
16//
17// | | true | == "" | is "" | strunzone |
18// | :----------: | :--: | :---: | :---: | :-------: |
19// | nil | | yes | | |
20// | strcat(nil) | yes | yes | | |
21// | strzone(nil) | yes | yes | | yes |
22// | "" | yes | yes | yes | |
23// | strcat("") | yes | yes | | |
24// | strzone("") | yes | yes | | yes |
25// | "s" | yes | | | |
26// | strcat("s") | yes | | | |
27// | strzone("s") | yes | | | yes |
28
29#ifdef CSQC
30 float stringwidth_colors(string s, vector theSize)
31 {
32 return stringwidth_builtin(s, true, theSize);
33 }
34
35 float stringwidth_nocolors(string s, vector theSize)
36 {
37 return stringwidth_builtin(s, false, theSize);
38 }
39#elifdef MENUQC
40 float stringwidth_colors(string s, vector theSize)
41 {
42 return stringwidth(s, true, theSize);
43 }
44
45 float stringwidth_nocolors(string s, vector theSize)
46 {
47 return stringwidth(s, false, theSize);
48 }
49#endif
50
51#define strcpy(this, s) MACRO_BEGIN \
52 if (this) \
53 strunzone(this); \
54 this = strzone(s); \
55MACRO_END
56
57#define strfree(this) MACRO_BEGIN \
58 if (this) \
59 strunzone(this); \
60 this = string_null; \
61MACRO_END
62
67int days_up_to_date(int Y, int M, int D)
68{
69 int years = (M <= 2) ? Y - 1 : Y;
70
71 int leap_days = floor(years / 4) - floor(years / 100) + floor(years / 400);
72
73 // using these 2 formulas to save 2 arrays or switches (performance isn't important here)
74 int months = (M <= 2) ? (M + 9) : (M - 3); // 10, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
75 int leftover_days = (M <= 2) ? (M + 5) : floor(0.58 * M - 1.1); // 6, 7, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5
76
77 int month_days = 30 * months + leftover_days;
78
79 return 365 * years + month_days + D + leap_days;
80}
81
82#define DAYS_UP_TO_EPOCH 719469 // days_up_to_date(1970, 1, 1);
83
91string strftime_s()
92{
93 string date = strftime(false, "%Y-%m-%d %H:%M:%S");
94 int i, seconds = 0;
95 i =0; int Y = stof(substring(date, i, 4)); // years
96 i+=5; int M = stof(substring(date, i, 2)); // months
97 i+=3; int D = stof(substring(date, i, 2)); // days
98
99 i+=3; seconds += stof(substring(date, i, 2)) * 60 * 60; // hours
100 i+=3; seconds += stof(substring(date, i, 2)) * 60; // minutes
101 i+=3; seconds += stof(substring(date, i, 2)); // seconds
102
103 // doing so we loose precision
104 //seconds += (days_up_to_date(Y, M, D) - DAYS_UP_TO_EPOCH) * 24 * 60 * 60;
105 //return ftos(seconds);
106
107 int days_since_epoch = days_up_to_date(Y, M, D) - DAYS_UP_TO_EPOCH;
108 // use hundreds of seconds as unit to avoid precision loss
109 int hundreds_of_seconds = days_since_epoch * 24 * 6 * 6;
110 hundreds_of_seconds += floor(seconds / 100);
111
112 // tens of seconds and seconds
113 string seconds_str = ftos(seconds % 100);
114 if ((seconds % 100) < 10)
115 seconds_str = strcat("0", seconds_str);
116
117 return strcat(ftos(hundreds_of_seconds), seconds_str);
118}
119
123string seconds_tostring(float seconds)
124{
125 bool negative = false;
126 if (seconds < 0)
127 {
128 negative = true;
129 seconds = -seconds;
130 if (floor(seconds) != seconds)
131 ++seconds; // make floor work in the other direction
132 }
133 int minutes = floor(seconds / 60);
134 seconds -= minutes * 60;
135 if (negative)
136 return sprintf("-%d:%02d", minutes, seconds);
137 return sprintf("%d:%02d", minutes, seconds);
138}
139
145string clockedtime_tostring(int tm, bool hundredths, bool compact)
146{
147 if (tm < 0)
148 {
149 if (compact)
150 return strcat("0.0", hundredths ? "0" : "");
151 else
152 return strcat("0:00.0", hundredths ? "0" : "");
153 }
154 int acc = hundredths ? 6000 : 600;
155 tm = floor(tm + 0.5);
156 int minutes = floor(tm / acc);
157 int tm_without_minutes = tm - minutes * acc;
158 // NOTE: the start digit of s is a placeholder and won't be displayed
159 string s = ftos(acc * 10 + tm_without_minutes);
160 if (!compact || minutes > 0)
161 return strcat(ftos(minutes), ":", substring(s, 1, 2), ".", substring(s, 3, hundredths ? 2 : 1));
162
163 int ofs = 2, digits = 1;
164 if (tm_without_minutes >= 10 * (hundredths ? 100 : 10))
165 {
166 ofs = 1;
167 digits = 2;
168 }
169 return strcat(substring(s, ofs, digits), ".", substring(s, 3, hundredths ? 2 : 1));
170
171}
172
173#define mmsst(tm, compact) clockedtime_tostring(tm, false, compact)
174#define mmssth(tm, compact) clockedtime_tostring(tm, true, compact)
175
177string format_time(float seconds)
178{
179 seconds = floor(seconds + 0.5);
180 float days = floor(seconds / 864000);
181 seconds -= days * 864000;
182 float hours = floor(seconds / 36000);
183 seconds -= hours * 36000;
184 float minutes = floor(seconds / 600);
185 seconds -= minutes * 600;
186 if (days > 0)
187 return sprintf(_("%d days, %02d:%02d:%02d"), days, hours, minutes, seconds);
188 return sprintf(_("%02d:%02d:%02d"), hours, minutes, seconds);
189}
190
192
194string ColorTranslateRGB(string s)
195{
196 return (ColorTranslateMode & 1) ? strdecolorize(s) : s;
197}
198
199#ifdef GAMEQC
200// color code replace, place inside of sprintf and parse the string... defaults described as constants
201// foreground/normal colors
206// "kill" colors
210// background color
212
214string CCR(string input)
215{
216 // foreground/normal colors
217 input = strreplace("^F1", strcat("^", autocvar_hud_colorset_foreground_1), input);
218 input = strreplace("^F2", strcat("^", autocvar_hud_colorset_foreground_2), input);
219 input = strreplace("^F3", strcat("^", autocvar_hud_colorset_foreground_3), input);
220 input = strreplace("^F4", strcat("^", autocvar_hud_colorset_foreground_4), input);
221
222 // "kill" colors
223 input = strreplace("^K1", strcat("^", autocvar_hud_colorset_kill_1), input);
224 input = strreplace("^K2", strcat("^", autocvar_hud_colorset_kill_2), input);
225 input = strreplace("^K3", strcat("^", autocvar_hud_colorset_kill_3), input);
226
227 // background colors
228 input = strreplace("^BG", strcat("^", autocvar_hud_colorset_background), input);
229 input = strreplace("^N", "^7", input); // "none"-- reset to white...
230 return input;
231}
232#endif
233
234#define startsWith(haystack, needle) (strstrofs(haystack, needle, 0) == 0)
235
237bool startsWithNocase(string haystack, string needle)
238{
239 return strcasecmp(substring(haystack, 0, strlen(needle)), needle) == 0;
240}
241
242noref string _endsWith_suffix;
243#define endsWith(this, suffix) (_endsWith_suffix = suffix, substring(this, -strlen(_endsWith_suffix), -1) == _endsWith_suffix)
244
247string fstrunzone(string s)
248{
249 if (!s)
250 return s;
251 string sc = strcat(s, "");
252 strunzone(s);
253 return sc;
254}
255
258string car(string s)
259{
260 int o = strstrofs(s, " ", 0);
261 if (o < 0)
262 return s;
263 return substring(s, 0, o);
264}
265
268string cdr(string s)
269{
270 int o = strstrofs(s, " ", 0);
271 if (o < 0)
272 return string_null;
273 return substring(s, o + 1, strlen(s) - (o + 1));
274}
275
277string cons(string a, string b)
278{
279 if (a == "") return b;
280 if (b == "") return a;
281 return strcat(a, " ", b);
282}
283
285string cons_mid(string a, string mid, string b)
286{
287 if (a == "") return b;
288 if (b == "") return a;
289 return strcat(a, mid, b);
290}
291
293string substring_range(string s, float b, float e)
294{
295 return substring(s, b, e - b);
296}
297
299string swapwords(string str, float i, float j)
300{
301 string s1, s2, s3, s4, s5;
302 float si, ei, sj, ej, s0, en;
303 int n = tokenizebyseparator(str, " ");
304 si = argv_start_index(i);
305 sj = argv_start_index(j);
306 ei = argv_end_index(i);
307 ej = argv_end_index(j);
308 s0 = argv_start_index(0);
309 en = argv_end_index(n - 1);
310 s1 = substring_range(str, s0, si);
311 s2 = argv(i);
312 s3 = substring_range(str, ei, sj);
313 s4 = argv(j);
314 s5 = substring_range(str, ej, en);
315 return strcat(s1, s4, s3, s2, s5);
316}
317
320void _shufflewords_swapfunc(float i, float j, entity pass)
321{
323}
324
326string shufflewords(string str)
327{
328 _shufflewords_str = str;
329 int n = tokenizebyseparator(str, " ");
331 str = _shufflewords_str;
333 return str;
334}
335
337string unescape(string in)
338{
339 in = strzone(in); // but it doesn't seem to be necessary in my tests at least
340
341 int len = strlen(in);
342 string str = "";
343 for (int i = 0; i < len; ++i)
344 {
345 string s = substring(in, i, 1);
346 if (s == "\\")
347 {
348 s = substring(in, i + 1, 1);
349 if (s == "n")
350 str = strcat(str, "\n");
351 else if (s == "\\")
352 str = strcat(str, "\\");
353 else
354 str = strcat(str, substring(in, i, 2));
355 ++i;
356 continue;
357 }
358 str = strcat(str, s);
359 }
360 strunzone(in);
361 return str;
362}
363
365string strwords(string s, int w)
366{
367 int endpos = 0;
368 for (; w && endpos >= 0; --w)
369 endpos = strstrofs(s, " ", endpos + 1);
370 if (endpos < 0)
371 return s;
372 return substring(s, 0, endpos);
373}
374
375#define strhasword(s, w) (strstrofs(strcat(" ", s, " "), strcat(" ", w, " "), 0) >= 0)
376
378int u8_strsize(string s)
379{
380 int l = 0;
381 for (int i = 0, c; (c = str2chr(s, i)) > 0; ++i, ++l)
382 {
383 l += (c >= 0x80);
384 l += (c >= 0x800);
385 l += (c >= 0x10000);
386 }
387 return l;
388}
389
390// List of Unicode spaces: http://jkorpela.fi/chars/spaces.html
392bool isInvisibleString(string s)
393{
394 s = strdecolorize(s);
395 bool utf8 = cvar("utf8_enable");
396 for (int i = 0, n = strlen(s); i < n; ++i)
397 {
398 int c = str2chr(s, i);
399 switch (c)
400 {
401 case 0:
402 case 32: // space
403 break;
404 case 192: // charmap space
405 if (!utf8)
406 break;
407 return false;
408 case 0xE000: // invisible char of the utf8 quake charmap
409 case 0xE00A: // invisible char of the utf8 quake charmap
410 case 0xE0A0: // invisible char of the utf8 quake charmap
411 case 0xE020: // invisible char of the utf8 quake charmap
412 case 0x00A0: // NO-BREAK SPACE
413 case 0x180E: // MONGOLIAN VOWEL SEPARATOR
414 case 0x2000: // EN QUAD
415 case 0x2001: // EM QUAD
416 case 0x2002: // EN SPACE
417 case 0x2003: // EM SPACE
418 case 0x2004: // THREE-PER-EM SPACE
419 case 0x2005: // FOUR-PER-EM SPACE
420 case 0x2006: // SIX-PER-EM SPACE
421 case 0x2007: // FIGURE SPACE
422 case 0x2008: // PUNCTUATION SPACE
423 case 0x2009: // THIN SPACE
424 case 0x200A: // HAIR SPACE
425 case 0x200B: // ZERO WIDTH SPACE
426 case 0x202F: // NARROW NO-BREAK SPACE
427 case 0x205F: // MEDIUM MATHEMATICAL SPACE
428 case 0x3000: // IDEOGRAPHIC SPACE
429 case 0xFEFF: // ZERO WIDTH NO-BREAK SPACE
430 case 0xFFA0: // Halfwidth Hangul Filler
431 case 0x3164: // Hangul Filler
432 if (utf8)
433 break;
434 default:
435 return false;
436 }
437 }
438 return true;
439}
440
441// Multiline text file buffers
442
444int buf_load(string pFilename)
445{
446 int buf = buf_create();
447 if (buf < 0)
448 return -1;
449 int fh = fopen(pFilename, FILE_READ);
450 if (fh < 0)
451 {
452 buf_del(buf);
453 return -1;
454 }
455 string l;
456 for (int i = 0; (l = fgets(fh)); ++i)
457 bufstr_set(buf, i, l);
458 fclose(fh);
459 return buf;
460}
461
463void buf_save(float buf, string pFilename)
464{
465 int fh = fopen(pFilename, FILE_WRITE);
466 if (fh < 0)
467 error(strcat("Can't write buf to ", pFilename));
468 int n = buf_getsize(buf);
469 for (int i = 0; i < n; ++i)
470 fputs(fh, strcat(bufstr_get(buf, i), "\n"));
471 fclose(fh);
472}
473
476string ftos_decimals(float number, int decimals)
477{
478 // inhibit stupid negative zero
479 if (number == 0) number = 0;
480 return sprintf("%.*f", decimals, number);
481}
482
485string ftos_decimals_percentage(float number, int decimals)
486{
487 if (number == 0)
488 number = 0; // inhibit stupid negative zero
489 return sprintf(_("%.*f%%"), decimals, number * 100); // translatable percentage string
490}
491
503{
504 // inhibit stupid negative zero
505 if (fabs(number) < 0.0001)
506 return "0";
507
508 int rounded = rint(number);
509 if (fabs(number - rounded) < 0.0001)
510 return ftos(rounded);
511
512 string s = sprintf("%.4f", number);
513
514 // if the decimal part got lost (large numbers), return what we got
515 int dot_ofs = strstrofs(s, ".", 0);
516 if (dot_ofs < 0)
517 return s;
518
519 // count trailing zeros that will need to be removed
520 string ch = "";
521 int i = 0;
522 for (; i < 4; ++i)
523 {
524 ch = substring(s, -1 - i, -1 - i);
525 if (ch != "0")
526 break;
527 }
528
529 // no trailing zeros, return what we got
530 // FLOAT_NAN falls under this case and returned as is ("-1.#IND")
531 if (i == 0)
532 return s;
533
534 // if we've found 4 trailing zeros (i == 4) assume the next char is a dot and remove it too
535 // ch == "." handles cases where the decimal part has less than 4 decimal digits (large numbers)
536 if (i == 4 || ch == ".")
537 ++i; // remove dot too
538
539 return substring(s, 0, -1 - i);
540}
541
543int vercmp_recursive(string v1, string v2)
544{
545 int dot1 = strstrofs(v1, ".", 0);
546 int dot2 = strstrofs(v2, ".", 0);
547 string s1 = (dot1 == -1) ? v1 : substring(v1, 0, dot1);
548 string s2 = (dot2 == -1) ? v2 : substring(v2, 0, dot2);
549
550 float r = stof(s1) - stof(s2);
551 if (r != 0)
552 return r;
553 r = strcasecmp(s1, s2);
554 if (r != 0)
555 return r;
556
557 if (dot1 == -1)
558 return (dot2 == -1) ? 0 : -1;
559 return (dot2 == -1) ? 1 : vercmp_recursive(substring(v1, dot1 + 1, 999), substring(v2, dot2 + 1, 999));
560}
561
563int vercmp(string v1, string v2)
564{
565 if (strcasecmp(v1, v2) == 0)
566 return 0; // early out check
567
568 // "git" beats all
569 if (v1 == "git") return 1;
570 if (v2 == "git") return -1;
571
572 return vercmp_recursive(v1, v2);
573}
574
575const string HEXDIGITS_MINSET = "0123456789ABCDEFabcdef";
576const string HEXDIGITS = "0123456789ABCDEF0123456789abcdef";
577#define HEXDIGIT_TO_DEC_RAW(d) (strstrofs(HEXDIGITS, (d), 0))
578#define HEXDIGIT_TO_DEC(d) ((HEXDIGIT_TO_DEC_RAW(d) | 0x10) - 0x10)
579#define DEC_TO_HEXDIGIT(d) (substring(HEXDIGITS_MINSET, (d), 1))
580#define IS_HEXDIGIT(d) (strstrofs(HEXDIGITS_MINSET, (d), 0) >= 0)
581
582const string DIGITS = "0123456789";
583#define IS_DIGIT(d) (strstrofs(DIGITS, (d), 0) >= 0)
584
587bool isCaretEscaped(string theText, float pos)
588{
589 // count all the previous carets
590 int carets = 0;
591 while (pos - carets >= 1 && substring(theText, pos - carets - 1, 1) == "^")
592 ++carets;
593 // if number of previous carets is odd then this carets is escaped
594 return (carets & 1);
595}
596
598bool isValidColorCodeValue(string theText, int cc_len, int tag_start)
599{
600 if (cc_len == 2)
601 return IS_DIGIT(substring(theText, tag_start + 1, 1));
602 if (cc_len == 5)
603 return (IS_HEXDIGIT(substring(theText, tag_start + 2, 1))
604 && IS_HEXDIGIT(substring(theText, tag_start + 3, 1))
605 && IS_HEXDIGIT(substring(theText, tag_start + 4, 1)));
606 return false;
607}
608
616vector checkColorCode(string theText, int text_len, int pos, bool check_at_the_end)
617{
618 if (text_len == 0)
619 text_len = strlen(theText);
620 string tag_type = "^";
621 int cc_len = 2;
622 int tag_len = 1;
623
624 LABEL(check_color_tag)
625
626 int ofs = cc_len;
627 if (!check_at_the_end)
628 --ofs;
629 for (; ofs >= 1; --ofs)
630 {
631 if (!(pos >= ofs && text_len >= pos + (cc_len - ofs)))
632 continue;
633 if (substring(theText, pos - ofs, tag_len) == tag_type)
634 {
635 if (!isCaretEscaped(theText, pos - ofs) && isValidColorCodeValue(theText, cc_len, pos - ofs))
636 return eX * cc_len + eY * ofs;
637 }
638 }
639 if (cc_len == 2)
640 {
641 tag_type = "^x";
642 cc_len = 5;
643 tag_len = 2;
644 goto check_color_tag;
645 }
646 return '0 0 0';
647}
648
649
650#define PAGE_TEXT_INIT() string _page_text = ""
651#define PAGE_TEXT _page_text
657#define PAR(...) EVAL_PAR(OVERLOAD(PAR, __VA_ARGS__))
658#define EVAL_PAR(...) __VA_ARGS__
659#define PAR_1(msg) _page_text = (_page_text == "" ? msg : strcat(_page_text, "\n\n", msg))
660#define PAR_2(msg, a1) MACRO_BEGIN string _msg = sprintf(msg, a1); PAR_1(_msg); MACRO_END
661#define PAR_3(msg, a1, a2) MACRO_BEGIN string _msg = sprintf(msg, a1, a2); PAR_1(_msg); MACRO_END
662#define PAR_4(msg, a1, a2, a3) MACRO_BEGIN string _msg = sprintf(msg, a1, a2, a3); PAR_1(_msg); MACRO_END
663#define PAR_5(msg, a1, a2, a3, a4) MACRO_BEGIN string _msg = sprintf(msg, a1, a2, a3, a4); PAR_1(_msg); MACRO_END
664#define PAR_6(msg, a1, a2, a3, a4, a5) MACRO_BEGIN string _msg = sprintf(msg, a1, a2, a3, a4, a5); PAR_1(_msg); MACRO_END
665#define PAR_7(msg, a1, a2, a3, a4, a5, a6) MACRO_BEGIN string _msg = sprintf(msg, a1, a2, a3, a4, a5, a6); PAR_1(_msg); MACRO_END
666#define PAR_8(msg, a1, a2, a3, a4, a5, a6, a7) MACRO_BEGIN string _msg = sprintf(msg, a1, a2, a3, a4, a5, a6, a7); PAR_1(_msg); MACRO_END
667#define PAR_9(msg, a1, a2, a3, a4, a5, a6, a7, a8) MACRO_BEGIN string _msg = sprintf(msg, a1, a2, a3, a4, a5, a6, a7, a8); PAR_1(_msg); MACRO_END
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define LABEL(id)
Definition compiler.qh:34
const float FILE_READ
const float FILE_WRITE
#define stringwidth
#define str2chr
#define strstrofs
#define argv_end_index
#define strlen
#define tokenizebyseparator
#define buf_create
#define strcasecmp
#define argv_start_index
#define pass(name, colormin, colormax)
#define ERASEABLE
Definition _all.inc:37
string fgets(float fhandle)
void fclose(float fhandle)
float stof(string val,...)
void fputs(float fhandle, string s)
string substring(string s, float start, float length)
float cvar(string name)
float fopen(string filename, float mode)
void strunzone(string s)
float rint(float f)
string ftos(float f)
float fabs(float f)
float floor(float f)
string strzone(string s)
string argv(float n)
string string_null
Definition nil.qh:9
spree_inf s1 s2 s3loc s2 s1
Definition all.inc:284
spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2 f1points s1 s2
Definition all.inc:474
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
#define NULL
Definition post.qh:14
#define error
Definition pre.qh:6
vector
Definition self.qh:96
int int number
Definition impulse.qc:89
ERASEABLE void shuffle(float n, swapfunc_t swap, entity pass)
Definition sort.qh:40
ERASEABLE bool isCaretEscaped(string theText, float pos)
Returns true if the caret at position pos is escaped.
Definition string.qh:587
ERASEABLE string ColorTranslateRGB(string s)
Definition string.qh:194
ERASEABLE int buf_load(string pFilename)
Definition string.qh:444
ERASEABLE string car(string s)
Returns first word.
Definition string.qh:258
string autocvar_hud_colorset_foreground_1
F1 - Green : primary priority (important names, etc).
Definition string.qh:202
string autocvar_hud_colorset_kill_1
K1 - Red : "bad" or "dangerous" text (death messages against you, kill notifications,...
Definition string.qh:207
ERASEABLE int vercmp_recursive(string v1, string v2)
Definition string.qh:543
const string DIGITS
Definition string.qh:582
const string HEXDIGITS_MINSET
Definition string.qh:575
ERASEABLE string ftos_decimals(float number, int decimals)
Converts a number to a string with the indicated number of decimals.
Definition string.qh:476
ERASEABLE string shufflewords(string str)
Definition string.qh:326
string autocvar_hud_colorset_kill_2
K2 - Yellow : similar to above, but less important... OR, a highlight out of above message type.
Definition string.qh:208
ERASEABLE void buf_save(float buf, string pFilename)
Definition string.qh:463
#define IS_DIGIT(d)
Definition string.qh:583
ERASEABLE void _shufflewords_swapfunc(float i, float j, entity pass)
Definition string.qh:320
ERASEABLE string cdr(string s)
Returns all but first word.
Definition string.qh:268
ERASEABLE string substring_range(string s, float b, float e)
Definition string.qh:293
#define DAYS_UP_TO_EPOCH
Definition string.qh:82
ERASEABLE bool isValidColorCodeValue(string theText, int cc_len, int tag_start)
Definition string.qh:598
ERASEABLE string strwords(string s, int w)
Definition string.qh:365
ERASEABLE string seconds_tostring(float seconds)
Definition string.qh:123
ERASEABLE int u8_strsize(string s)
Definition string.qh:378
noref string _endsWith_suffix
Definition string.qh:242
ERASEABLE string fstrunzone(string s)
unzone the string, and return it as tempstring. Safe to be called on string_null
Definition string.qh:247
ERASEABLE int vercmp(string v1, string v2)
Definition string.qh:563
string autocvar_hud_colorset_foreground_3
F3 - Blue : tertiary priority or relatively inconsequential text.
Definition string.qh:204
string CCR(string input)
color code replace, place inside of sprintf and parse the string
Definition string.qh:214
ERASEABLE string cons_mid(string a, string mid, string b)
Definition string.qh:285
string autocvar_hud_colorset_foreground_4
F4 - Red : notice/attention grabbing texting.
Definition string.qh:205
ERASEABLE bool startsWithNocase(string haystack, string needle)
Definition string.qh:237
ERASEABLE vector checkColorCode(string theText, int text_len, int pos, bool check_at_the_end)
Returns 0 if pos is NOT in the middle or at the end of a color code otherwise it returns a vector wit...
Definition string.qh:616
int ColorTranslateMode
Definition string.qh:191
ERASEABLE bool isInvisibleString(string s)
Definition string.qh:392
string _shufflewords_str
Definition string.qh:318
ERASEABLE string cons(string a, string b)
Definition string.qh:277
string autocvar_hud_colorset_background
BG - White : neutral/unimportant text.
Definition string.qh:211
ERASEABLE string unescape(string in)
Definition string.qh:337
#define IS_HEXDIGIT(d)
Definition string.qh:580
const string HEXDIGITS
Definition string.qh:576
ERASEABLE string swapwords(string str, float i, float j)
Definition string.qh:299
string autocvar_hud_colorset_foreground_2
F2 - Yellow : secondary priority (items, locations, numbers, etc).
Definition string.qh:203
ERASEABLE int days_up_to_date(int Y, int M, int D)
Returns the number of days since 0000-03-01 (March 1, year 0).
Definition string.qh:67
ERASEABLE string clockedtime_tostring(int tm, bool hundredths, bool compact)
Definition string.qh:145
ERASEABLE string ftos_mindecimals(float number)
Converts a number to a string with the minimum number of decimals It assumes that an extreme accuracy...
Definition string.qh:502
ERASEABLE string ftos_decimals_percentage(float number, int decimals)
Converts a percentage to a string with the indicated number of decimals.
Definition string.qh:485
float stringwidth_nocolors(string s, vector theSize)
Definition string.qh:35
ERASEABLE string strftime_s()
Returns the number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
Definition string.qh:91
string autocvar_hud_colorset_kill_3
K3 - Blue : "good" or "beneficial" text (you fragging someone, etc).
Definition string.qh:209
ERASEABLE string format_time(float seconds)
Definition string.qh:177
float stringwidth_colors(string s, vector theSize)
Definition string.qh:30
const vector eY
Definition vector.qh:44
const vector eX
Definition vector.qh:43