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#endif
40#ifdef MENUQC
41 float stringwidth_colors(string s, vector theSize)
42 {
43 return stringwidth(s, true, theSize);
44 }
45
46 float stringwidth_nocolors(string s, vector theSize)
47 {
48 return stringwidth(s, false, theSize);
49 }
50#endif
51
52#define strcpy(this, s) MACRO_BEGIN \
53 if (this) { \
54 strunzone(this); \
55 } \
56 this = strzone(s); \
57MACRO_END
58
59#define strfree(this) MACRO_BEGIN \
60 if (this) { \
61 strunzone(this); \
62 } \
63 this = string_null; \
64MACRO_END
65
66// Returns the number of days since 0000-03-01 (March 1, year 0)
67// Starting counting from March, as the 1st month of the year, February becomes the 12th and last month,
68// so its variable duration does not affect, given that the 29th is the last day of the period
70int days_up_to_date(int Y, int M, int D)
71{
72 int years = (M <= 2) ? Y - 1 : Y;
73
74 int leap_days = floor(years / 4) - floor(years / 100) + floor(years / 400);
75
76 // using these 2 formulas to save 2 arrays or switches (performance isn't important here)
77 int months = (M <= 2) ? (M + 9) : (M - 3); // 10, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
78 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
79
80 int month_days = 30 * months + leftover_days;
81
82 return 365 * years + month_days + D + leap_days;
83}
84
85#define DAYS_UP_TO_EPOCH 719469 // days_up_to_date(1970, 1, 1);
86
87// Returns the number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
88// This function exists only as a replacement for strftime(false, "%s") which doesn't work
89// on Windows (%s is not supported) and at least in some linux systems doesn't return the
90// correct result
91// NOTE: at the current date, the number (string) returned by both strftime(false, "%s") and
92// strftime_s() is so high that can't be converted to int (with ftos) without precision loss
94string strftime_s()
95{
96 string date = strftime(false, "%Y-%m-%d %H:%M:%S");
97 int i, seconds = 0;
98 i =0; int Y = stof(substring(date, i, 4)); // years
99 i+=5; int M = stof(substring(date, i, 2)); // months
100 i+=3; int D = stof(substring(date, i, 2)); // days
101
102 i+=3; seconds += stof(substring(date, i, 2)) * 60 * 60; // hours
103 i+=3; seconds += stof(substring(date, i, 2)) * 60; // minutes
104 i+=3; seconds += stof(substring(date, i, 2)); // seconds
105
106 // doing so we loose precision
107 //seconds += (days_up_to_date(Y, M, D) - DAYS_UP_TO_EPOCH) * 24 * 60 * 60;
108 //return ftos(seconds);
109
110 int days_since_epoch = days_up_to_date(Y, M, D) - DAYS_UP_TO_EPOCH;
111 // use hundreds of seconds as unit to avoid precision loss
112 int hundreds_of_seconds = days_since_epoch * 24 * 6 * 6;
113 hundreds_of_seconds += floor(seconds / 100);
114
115 // tens of seconds and seconds
116 string seconds_str = ftos(seconds % 100);
117 if ((seconds % 100) < 10)
118 seconds_str = strcat("0", seconds_str);
119
120 return strcat(ftos(hundreds_of_seconds), seconds_str);
121}
122
126string seconds_tostring(float seconds)
127{
128 bool negative = false;
129 if (seconds < 0)
130 {
131 negative = true;
132 seconds = -seconds;
133 if (floor(seconds) != seconds)
134 seconds += 1; // make floor work in the other direction
135 }
136 int minutes = floor(seconds / 60);
137 seconds -= minutes * 60;
138 if (negative)
139 return sprintf("-%d:%02d", minutes, seconds);
140 return sprintf("%d:%02d", minutes, seconds);
141}
142
148string clockedtime_tostring(int tm, bool hundredths, bool compact)
149{
150 if (tm < 0)
151 {
152 if (compact)
153 return strcat("0.0", hundredths ? "0" : "");
154 else
155 return strcat("0:00.0", hundredths ? "0" : "");
156 }
157 int acc = hundredths ? 6000 : 600;
158 tm = floor(tm + 0.5);
159 int minutes = floor(tm / acc);
160 int tm_without_minutes = tm - minutes * acc;
161 // NOTE: the start digit of s is a placeholder and won't be displayed
162 string s = ftos(acc * 10 + tm_without_minutes);
163 if (!compact || minutes > 0)
164 return strcat(ftos(minutes), ":", substring(s, 1, 2), ".", substring(s, 3, hundredths ? 2 : 1));
165
166 int ofs = 2, digits = 1;
167 if (tm_without_minutes >= 10 * (hundredths ? 100 : 10))
168 {
169 ofs = 1;
170 digits = 2;
171 }
172 return strcat(substring(s, ofs, digits), ".", substring(s, 3, hundredths ? 2 : 1));
173
174}
175
176#define mmsst(tm, compact) clockedtime_tostring(tm, false, compact)
177#define mmssth(tm, compact) clockedtime_tostring(tm, true, compact)
178
180string format_time(float seconds)
181{
182 seconds = floor(seconds + 0.5);
183 float days = floor(seconds / 864000);
184 seconds -= days * 864000;
185 float hours = floor(seconds / 36000);
186 seconds -= hours * 36000;
187 float minutes = floor(seconds / 600);
188 seconds -= minutes * 600;
189 if (days > 0) return sprintf(_("%d days, %02d:%02d:%02d"), days, hours, minutes, seconds);
190 else return sprintf(_("%02d:%02d:%02d"), hours, minutes, seconds);
191}
192
194
196string ColorTranslateRGB(string s)
197{
198 return (ColorTranslateMode & 1) ? strdecolorize(s) : s;
199}
200
201#ifdef GAMEQC
202// color code replace, place inside of sprintf and parse the string... defaults described as constants
203// foreground/normal colors
204string autocvar_hud_colorset_foreground_1 = "2"; // F1 - Green // primary priority (important names, etc)
205string autocvar_hud_colorset_foreground_2 = "3"; // F2 - Yellow // secondary priority (items, locations, numbers, etc)
206string autocvar_hud_colorset_foreground_3 = "4"; // F3 - Blue // tertiary priority or relatively inconsequential text
207string autocvar_hud_colorset_foreground_4 = "1"; // F4 - Red // notice/attention grabbing texting
208// "kill" colors
209string autocvar_hud_colorset_kill_1 = "1"; // K1 - Red // "bad" or "dangerous" text (death messages against you, kill notifications, etc)
210string autocvar_hud_colorset_kill_2 = "3"; // K2 - Yellow // similar to above, but less important... OR, a highlight out of above message type
211string autocvar_hud_colorset_kill_3 = "4"; // K3 - Blue // "good" or "beneficial" text (you fragging someone, etc)
212// background color
213string autocvar_hud_colorset_background = "7"; // BG - White // neutral/unimportant text
214
216string CCR(string input)
217{
218 // foreground/normal colors
219 input = strreplace("^F1", strcat("^", autocvar_hud_colorset_foreground_1), input);
220 input = strreplace("^F2", strcat("^", autocvar_hud_colorset_foreground_2), input);
221 input = strreplace("^F3", strcat("^", autocvar_hud_colorset_foreground_3), input);
222 input = strreplace("^F4", strcat("^", autocvar_hud_colorset_foreground_4), input);
223
224 // "kill" colors
225 input = strreplace("^K1", strcat("^", autocvar_hud_colorset_kill_1), input);
226 input = strreplace("^K2", strcat("^", autocvar_hud_colorset_kill_2), input);
227 input = strreplace("^K3", strcat("^", autocvar_hud_colorset_kill_3), input);
228
229 // background colors
230 input = strreplace("^BG", strcat("^", autocvar_hud_colorset_background), input);
231 input = strreplace("^N", "^7", input); // "none"-- reset to white...
232 return input;
233}
234#endif
235
236#define startsWith(haystack, needle) (strstrofs(haystack, needle, 0) == 0)
237
239bool startsWithNocase(string haystack, string needle)
240{
241 return strcasecmp(substring(haystack, 0, strlen(needle)), needle) == 0;
242}
243
244noref string _endsWith_suffix;
245#define endsWith(this, suffix) (_endsWith_suffix = suffix, substring(this, -strlen(_endsWith_suffix), -1) == _endsWith_suffix)
246
249string fstrunzone(string s)
250{
251 if (!s) return s;
252 string sc = strcat(s, "");
253 strunzone(s);
254 return sc;
255}
256
259string car(string s)
260{
261 int o = strstrofs(s, " ", 0);
262 if (o < 0) 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) return string_null;
272 return substring(s, o + 1, strlen(s) - (o + 1));
273}
274
276string cons(string a, string b)
277{
278 if (a == "") return b;
279 if (b == "") return a;
280 return strcat(a, " ", b);
281}
282
284string cons_mid(string a, string mid, string b)
285{
286 if (a == "") return b;
287 if (b == "") return a;
288 return strcat(a, mid, b);
289}
290
292string substring_range(string s, float b, float e)
293{
294 return substring(s, b, e - b);
295}
296
298string swapwords(string str, float i, float j)
299{
300 string s1, s2, s3, s4, s5;
301 float si, ei, sj, ej, s0, en;
302 int n = tokenizebyseparator(str, " ");
303 si = argv_start_index(i);
304 sj = argv_start_index(j);
305 ei = argv_end_index(i);
306 ej = argv_end_index(j);
307 s0 = argv_start_index(0);
308 en = argv_end_index(n - 1);
309 s1 = substring_range(str, s0, si);
310 s2 = argv(i);
311 s3 = substring_range(str, ei, sj);
312 s4 = argv(j);
313 s5 = substring_range(str, ej, en);
314 return strcat(s1, s4, s3, s2, s5);
315}
316
319void _shufflewords_swapfunc(float i, float j, entity pass)
320{
322}
323
325string shufflewords(string str)
326{
327 _shufflewords_str = str;
328 int n = tokenizebyseparator(str, " ");
330 str = _shufflewords_str;
332 return str;
333}
334
336string unescape(string in)
337{
338 in = strzone(in); // but it doesn't seem to be necessary in my tests at least
339
340 int len = strlen(in);
341 string str = "";
342 for (int i = 0; i < len; ++i)
343 {
344 string s = substring(in, i, 1);
345 if (s == "\\")
346 {
347 s = substring(in, i + 1, 1);
348 if (s == "n") str = strcat(str, "\n");
349 else if (s == "\\") str = strcat(str, "\\");
350 else str = strcat(str, substring(in, i, 2));
351 ++i;
352 continue;
353 }
354 str = strcat(str, s);
355 }
356 strunzone(in);
357 return str;
358}
359
361string strwords(string s, int w)
362{
363 int endpos = 0;
364 for ( ; w && endpos >= 0; --w)
365 endpos = strstrofs(s, " ", endpos + 1);
366 if (endpos < 0) return s;
367 return substring(s, 0, endpos);
368}
369
370#define strhasword(s, w) (strstrofs(strcat(" ", s, " "), strcat(" ", w, " "), 0) >= 0)
371
373int u8_strsize(string s)
374{
375 int l = 0;
376 for (int i = 0, c; (c = str2chr(s, i)) > 0; ++i, ++l)
377 {
378 l += (c >= 0x80);
379 l += (c >= 0x800);
380 l += (c >= 0x10000);
381 }
382 return l;
383}
384
385// List of Unicode spaces: http://jkorpela.fi/chars/spaces.html
387bool isInvisibleString(string s)
388{
389 s = strdecolorize(s);
390 bool utf8 = cvar("utf8_enable");
391 for (int i = 0, n = strlen(s); i < n; ++i)
392 {
393 int c = str2chr(s, i);
394 switch (c)
395 {
396 case 0:
397 case 32: // space
398 break;
399 case 192: // charmap space
400 if (!utf8) break;
401 return false;
402 case 0xE000: // invisible char of the utf8 quake charmap
403 case 0xE00A: // invisible char of the utf8 quake charmap
404 case 0xE0A0: // invisible char of the utf8 quake charmap
405 case 0xE020: // invisible char of the utf8 quake charmap
406 case 0x00A0: // NO-BREAK SPACE
407 case 0x180E: // MONGOLIAN VOWEL SEPARATOR
408 case 0x2000: // EN QUAD
409 case 0x2001: // EM QUAD
410 case 0x2002: // EN SPACE
411 case 0x2003: // EM SPACE
412 case 0x2004: // THREE-PER-EM SPACE
413 case 0x2005: // FOUR-PER-EM SPACE
414 case 0x2006: // SIX-PER-EM SPACE
415 case 0x2007: // FIGURE SPACE
416 case 0x2008: // PUNCTUATION SPACE
417 case 0x2009: // THIN SPACE
418 case 0x200A: // HAIR SPACE
419 case 0x200B: // ZERO WIDTH SPACE
420 case 0x202F: // NARROW NO-BREAK SPACE
421 case 0x205F: // MEDIUM MATHEMATICAL SPACE
422 case 0x3000: // IDEOGRAPHIC SPACE
423 case 0xFEFF: // ZERO WIDTH NO-BREAK SPACE
424 case 0xFFA0: // Halfwidth Hangul Filler
425 case 0x3164: // Hangul Filler
426 if (utf8) break;
427 default:
428 return false;
429 }
430 }
431 return true;
432}
433
434// Multiline text file buffers
435
437int buf_load(string pFilename)
438{
439 int buf = buf_create();
440 if (buf < 0) return -1;
441 int fh = fopen(pFilename, FILE_READ);
442 if (fh < 0)
443 {
444 buf_del(buf);
445 return -1;
446 }
447 string l;
448 for (int i = 0; (l = fgets(fh)); ++i)
449 bufstr_set(buf, i, l);
450 fclose(fh);
451 return buf;
452}
453
455void buf_save(float buf, string pFilename)
456{
457 int fh = fopen(pFilename, FILE_WRITE);
458 if (fh < 0) error(strcat("Can't write buf to ", pFilename));
459 int n = buf_getsize(buf);
460 for (int i = 0; i < n; ++i)
461 fputs(fh, strcat(bufstr_get(buf, i), "\n"));
462 fclose(fh);
463}
464
469string ftos_decimals(float number, int decimals)
470{
471 // inhibit stupid negative zero
472 if (number == 0) number = 0;
473 return sprintf("%.*f", decimals, number);
474}
475
480string ftos_decimals_percentage(float number, int decimals)
481{
482 // inhibit stupid negative zero
483 if (number == 0) number = 0;
484 return sprintf(_("%.*f%%"), decimals, number * 100); // translatable percentage string
485}
486
498{
499 // inhibit stupid negative zero
500 if (fabs(number) < 0.0001)
501 return "0";
502
503 int rounded = rint(number);
504 if (fabs(number - rounded) < 0.0001)
505 return ftos(rounded);
506
507 string s = sprintf("%.4f", number);
508
509 // if the decimal part got lost (large numbers), return what we got
510 int dot_ofs = strstrofs(s, ".", 0);
511 if (dot_ofs < 0)
512 return s;
513
514 // count trailing zeros that will need to be removed
515 string ch = "";
516 int i = 0;
517 for ( ; i < 4; ++i)
518 {
519 ch = substring(s, -1 - i, -1 - i);
520 if (ch != "0")
521 break;
522 }
523
524 // no trailing zeros, return what we got
525 // FLOAT_NAN falls under this case and returned as is ("-1.#IND")
526 if (i == 0)
527 return s;
528
529 // if we've found 4 trailing zeros (i == 4) assume the next char is a dot and remove it too
530 // ch == "." handles cases where the decimal part has less than 4 decimal digits (large numbers)
531 if (i == 4 || ch == ".")
532 ++i; // remove dot too
533
534 return substring(s, 0, -1 - i);
535}
536
538int vercmp_recursive(string v1, string v2)
539{
540 int dot1 = strstrofs(v1, ".", 0);
541 int dot2 = strstrofs(v2, ".", 0);
542 string s1 = (dot1 == -1) ? v1 : substring(v1, 0, dot1);
543 string s2 = (dot2 == -1) ? v2 : substring(v2, 0, dot2);
544
545 float r;
546 r = stof(s1) - stof(s2);
547 if (r != 0) return r;
548
549 r = strcasecmp(s1, s2);
550 if (r != 0) return r;
551
552 if (dot1 == -1) return (dot2 == -1) ? 0 : -1;
553 else return (dot2 == -1) ? 1 : vercmp_recursive(substring(v1, dot1 + 1, 999), substring(v2, dot2 + 1, 999));
554}
555
557int vercmp(string v1, string v2)
558{
559 if (strcasecmp(v1, v2) == 0) return 0; // early out check
560
561 // "git" beats all
562 if (v1 == "git") return 1;
563 if (v2 == "git") return -1;
564
565 return vercmp_recursive(v1, v2);
566}
567
568const string HEXDIGITS_MINSET = "0123456789ABCDEFabcdef";
569const string HEXDIGITS = "0123456789ABCDEF0123456789abcdef";
570#define HEXDIGIT_TO_DEC_RAW(d) (strstrofs(HEXDIGITS, (d), 0))
571#define HEXDIGIT_TO_DEC(d) ((HEXDIGIT_TO_DEC_RAW(d) | 0x10) - 0x10)
572#define DEC_TO_HEXDIGIT(d) (substring(HEXDIGITS_MINSET, (d), 1))
573#define IS_HEXDIGIT(d) (strstrofs(HEXDIGITS_MINSET, (d), 0) >= 0)
574
575const string DIGITS = "0123456789";
576#define IS_DIGIT(d) (strstrofs(DIGITS, (d), 0) >= 0)
577
578// returns true if the caret at position pos is escaped
580bool isCaretEscaped(string theText, float pos)
581{
582 // count all the previous carets
583 int carets = 0;
584 while(pos - carets >= 1 && substring(theText, pos - carets - 1, 1) == "^")
585 ++carets;
586 // if number of previous carets is odd then this carets is escaped
587 return (carets & 1);
588}
589
591bool isValidColorCodeValue(string theText, int cc_len, int tag_start)
592{
593 if (cc_len == 2)
594 return IS_DIGIT(substring(theText, tag_start + 1, 1));
595 if (cc_len == 5)
596 return (IS_HEXDIGIT(substring(theText, tag_start + 2, 1))
597 && IS_HEXDIGIT(substring(theText, tag_start + 3, 1))
598 && IS_HEXDIGIT(substring(theText, tag_start + 4, 1)));
599 return false;
600}
601
602// it returns 0 if pos is NOT in the middle or at the end of a color code
603// otherwise it returns a vector with color code length as the first component
604// and the offset from '^' position to pos as the second component
605// e.g.:
606// "j^2kl" | returns 0 if pos == 0 or 1 or 4
607// ^^ | returns '2 1' or '2 2' if pos == 2 or 3
609vector checkColorCode(string theText, int text_len, int pos, bool check_at_the_end)
610{
611 if (text_len == 0)
612 text_len = strlen(theText);
613 string tag_type = "^";
614 int cc_len = 2;
615 int tag_len = 1;
616
617 LABEL(check_color_tag)
618
619 int ofs = cc_len;
620 if (!check_at_the_end)
621 ofs--;
622 for (; ofs >= 1; --ofs)
623 {
624 if (!(pos >= ofs && text_len >= pos + (cc_len - ofs)))
625 continue;
626 if(substring(theText, pos - ofs, tag_len) == tag_type)
627 {
628 if (!isCaretEscaped(theText, pos - ofs) && isValidColorCodeValue(theText, cc_len, pos - ofs))
629 return eX * cc_len + eY * ofs;
630 }
631 }
632 if (cc_len == 2)
633 {
634 tag_type = "^x";
635 cc_len = 5;
636 tag_len = 2;
637 goto check_color_tag;
638 }
639 return '0 0 0';
640}
641
642#define PAGE_TEXT_INIT() string _page_text = ""
643#define PAGE_TEXT _page_text
649#define PAR(...) EVAL_PAR(OVERLOAD(PAR, __VA_ARGS__))
650#define EVAL_PAR(...) __VA_ARGS__
651#define PAR_1(msg) _page_text = (_page_text == "" ? msg : strcat(_page_text, "\n\n", msg))
652#define PAR_2(msg, a1) MACRO_BEGIN string _msg = sprintf(msg, a1); PAR_1(_msg); MACRO_END
653#define PAR_3(msg, a1, a2) MACRO_BEGIN string _msg = sprintf(msg, a1, a2); PAR_1(_msg); MACRO_END
654#define PAR_4(msg, a1, a2, a3) MACRO_BEGIN string _msg = sprintf(msg, a1, a2, a3); PAR_1(_msg); MACRO_END
655#define PAR_5(msg, a1, a2, a3, a4) MACRO_BEGIN string _msg = sprintf(msg, a1, a2, a3, a4); PAR_1(_msg); MACRO_END
656#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
657#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
658#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
659#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:281
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:469
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:92
int int number
Definition impulse.qc:89
ERASEABLE void shuffle(float n, swapfunc_t swap, entity pass)
Definition sort.qh:42
ERASEABLE bool isCaretEscaped(string theText, float pos)
Definition string.qh:580
ERASEABLE string ColorTranslateRGB(string s)
Definition string.qh:196
ERASEABLE int buf_load(string pFilename)
Definition string.qh:437
ERASEABLE string car(string s)
returns first word
Definition string.qh:259
string autocvar_hud_colorset_foreground_1
Definition string.qh:204
string autocvar_hud_colorset_kill_1
Definition string.qh:209
ERASEABLE int vercmp_recursive(string v1, string v2)
Definition string.qh:538
const string DIGITS
Definition string.qh:575
const string HEXDIGITS_MINSET
Definition string.qh:568
ERASEABLE string ftos_decimals(float number, int decimals)
converts a number to a string with the indicated number of decimals
Definition string.qh:469
ERASEABLE string shufflewords(string str)
Definition string.qh:325
string autocvar_hud_colorset_kill_2
Definition string.qh:210
ERASEABLE void buf_save(float buf, string pFilename)
Definition string.qh:455
#define IS_DIGIT(d)
Definition string.qh:576
ERASEABLE void _shufflewords_swapfunc(float i, float j, entity pass)
Definition string.qh:319
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:292
#define DAYS_UP_TO_EPOCH
Definition string.qh:85
ERASEABLE bool isValidColorCodeValue(string theText, int cc_len, int tag_start)
Definition string.qh:591
ERASEABLE string strwords(string s, int w)
Definition string.qh:361
ERASEABLE string seconds_tostring(float seconds)
Definition string.qh:126
ERASEABLE int u8_strsize(string s)
Definition string.qh:373
noref string _endsWith_suffix
Definition string.qh:244
ERASEABLE string fstrunzone(string s)
unzone the string, and return it as tempstring.
Definition string.qh:249
ERASEABLE int vercmp(string v1, string v2)
Definition string.qh:557
string autocvar_hud_colorset_foreground_3
Definition string.qh:206
string CCR(string input)
color code replace, place inside of sprintf and parse the string
Definition string.qh:216
ERASEABLE string cons_mid(string a, string mid, string b)
Definition string.qh:284
string autocvar_hud_colorset_foreground_4
Definition string.qh:207
ERASEABLE bool startsWithNocase(string haystack, string needle)
Definition string.qh:239
ERASEABLE vector checkColorCode(string theText, int text_len, int pos, bool check_at_the_end)
Definition string.qh:609
int ColorTranslateMode
Definition string.qh:193
ERASEABLE bool isInvisibleString(string s)
Definition string.qh:387
string _shufflewords_str
Definition string.qh:317
ERASEABLE string cons(string a, string b)
Definition string.qh:276
string autocvar_hud_colorset_background
Definition string.qh:213
ERASEABLE string unescape(string in)
Definition string.qh:336
#define IS_HEXDIGIT(d)
Definition string.qh:573
const string HEXDIGITS
Definition string.qh:569
ERASEABLE string swapwords(string str, float i, float j)
Definition string.qh:298
string autocvar_hud_colorset_foreground_2
Definition string.qh:205
ERASEABLE int days_up_to_date(int Y, int M, int D)
Definition string.qh:70
ERASEABLE string clockedtime_tostring(int tm, bool hundredths, bool compact)
Definition string.qh:148
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:497
ERASEABLE string ftos_decimals_percentage(float number, int decimals)
converts a percentage to a string with the indicated number of decimals
Definition string.qh:480
float stringwidth_nocolors(string s, vector theSize)
Definition string.qh:35
ERASEABLE string strftime_s()
Definition string.qh:94
string autocvar_hud_colorset_kill_3
Definition string.qh:211
ERASEABLE string format_time(float seconds)
Definition string.qh:180
float stringwidth_colors(string s, vector theSize)
Definition string.qh:30
const vector eY
Definition vector.qh:45
const vector eX
Definition vector.qh:44