arduino-audio-tools
Loading...
Searching...
No Matches
StrView.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdio.h>
4#include <string.h>
5#include <stdlib.h>
7
16namespace audio_tools {
17
28class StrView {
29 public:
30 StrView() = default;
31
33 StrView(const char* chars) {
34 if (chars != nullptr) {
35 int len = strlen(chars);
36 set((char*)chars, len, len, true);
37 } else {
38 this->is_const = true;
39 clear();
40 }
41 }
42
44 StrView(char chars[], int maxlen, int len = 0) { set(chars, maxlen, len, false); }
45
47 virtual void set(const char* alt) {
48 if (alt == nullptr) {
49 this->len = 0;
50 } else {
51 int new_len = strlen(alt);
52 grow(new_len);
53 this->len = new_len;
54 if (this->isConst()) {
56 this->maxlen = this->len;
57 this->chars = (char*)alt;
58 } else {
60 strncpy(this->chars, alt, this->maxlen);
61 this->chars[len] = 0;
62 }
63 }
64 }
66 virtual void set(const StrView& alt) {
67 grow(alt.len);
68 this->len = alt.len;
69
70 if (this->isConst()) {
72 this->chars = alt.chars;
73 } else {
75 strncpy(this->chars, alt.chars, this->maxlen);
76 this->chars[len] = 0;
77 }
78 }
79
80 virtual void set(const char c) {
81 clear();
82 add(c);
83 }
84
85 virtual void set(int value) {
86 clear();
87 add(value);
88 }
89
90 virtual void set(double value, int precision = 2, int withd = 0) {
91 clear();
92 add(value);
93 }
94
95 virtual void swap(StrView& str) {
96 char* cpy_chars = chars;
97 ;
98 bool cpy_is_const = is_const;
99 int cpy_len = len;
100 int cpy_maxlen = maxlen;
101
102 chars = str.chars;
103 is_const = str.is_const;
104 len = str.len;
105 maxlen = str.maxlen;
106
107 str.chars = cpy_chars;
108 str.is_const = cpy_is_const;
109 str.len = cpy_len;
110 str.maxlen = cpy_maxlen;
111 }
112
114 virtual void set(char chars[], int maxlen, int len = 0,
115 bool isConst = false) {
116 this->chars = chars;
117 this->maxlen = maxlen;
118 this->len = len;
119 this->is_const = isConst;
120 if (len == 0 && !isConst) {
121 this->chars[0] = 0;
122 }
123 }
124
126 virtual void add(int value) {
127 if (!this->isConst()) {
128 grow(this->length() + 11);
129 snprintf(this->chars + len, 10, "%d", value);
130 len = strlen(chars);
131 }
132 }
133
135 virtual void add(double value, int precision = 2, int withd = 0) {
136 if (!this->isConst()) {
137 grow(this->length() + 20);
138 floatToString(this->chars + len, value, precision, withd);
139 len = strlen(chars);
140 }
141 }
142
144 virtual void add(const char* append) {
145 if (!isConst() && append != nullptr) {
146 int append_len = strlen(append);
147 grow(this->length() + append_len + 1);
148 int n = (len + append_len) < maxlen - 1 ? append_len : maxlen - len - 1;
149 strncat(chars, append, n);
150 chars[len + n] = 0;
151 len = strlen(chars);
152 }
153 }
154
156 virtual void add(const char c) {
157 if (!isConst() && len < maxlen - 1) {
158 grow(this->length() + 1);
159 chars[len] = c;
160 chars[++len] = 0;
161 }
162 }
163
165 virtual bool equals(const char* str) {
166 if (str == nullptr) return isEmpty();
167 return strcmp(this->chars, str) == 0;
168 }
169
171 virtual bool startsWith(const char* str) {
172 if (str == nullptr) return false;
173 int len = strlen(str);
174 return strncmp(this->chars, str, len) == 0;
175 }
176
178 virtual bool endsWith(const char* str) {
179 if (str == nullptr) return false;
180 int endlen = strlen(str);
181 return strncmp(this->chars + (len - endlen), str, endlen) == 0;
182 }
183
185 virtual bool endsWithIgnoreCase(const char* str) {
186 if (str == nullptr) return false;
187 int endlen = strlen(str);
188 return strncmp_i(this->chars + (len - endlen), str, endlen) == 0;
189 }
190
193 virtual bool matches(const char* pattern) {
196 int wildcard = 0;
197 const char* line = this->chars;
198
199 const char* last_pattern_start = 0;
200 const char* last_line_start = 0;
201 do {
202 if (*pattern == *line) {
203 if (wildcard == 1) last_line_start = line + 1;
204
205 line++;
206 pattern++;
207 wildcard = 0;
208 } else if (*pattern == '?') {
209 if (*(line) == '\0')
210 return 0;
211 if (wildcard == 1) last_line_start = line + 1;
212 line++;
213 pattern++;
214 wildcard = 0;
215 } else if (*pattern == '*') {
216 if (*(pattern + 1) == '\0') {
217 return 1;
218 }
219
220 last_pattern_start = pattern;
221 // last_line_start = line + 1;
222 wildcard = 1;
223
224 pattern++;
225 } else if (wildcard) {
226 if (*line == *pattern) {
227 wildcard = 0;
228 line++;
229 pattern++;
230 last_line_start = line + 1;
231 } else {
232 line++;
233 }
234 } else {
235 if ((*pattern) == '\0' && (*line) == '\0')
236 return 1;
237 else {
238 if (last_pattern_start != 0)
239 {
240 pattern = last_pattern_start;
241 line = last_line_start;
242 last_line_start = 0;
243 } else {
244 return false;
245 }
246 }
247 }
248
249 } while (*line);
250
251 if (*pattern == '\0') {
252 return true;
253 } else {
254 return false;
255 }
256 }
257
260 virtual int indexOf(const char c, int start = 0) {
261 for (int j = start; j < len; j++) {
262 if (c == chars[j]) {
263 return j;
264 }
265 }
266 return -1;
267 }
268
270 virtual int nIndexOf(const char c, int n){
271 int result = -1;
272 for (int j=0; j < n; j++){
273 result = indexOf(c, result + 1);
274 if (result < 0) break;
275 }
276 return result;
277 }
278
280 virtual bool contains(const char* str) { return indexOf(str) != -1; }
281
284 virtual int indexOf(const char* cont, int start = 0) {
285 if (chars == nullptr || cont == nullptr) return -1;
286 int contLen = strlen(cont);
287 for (int j = start; j < len; j++) {
288 char* pt = chars + j;
289 if (strncmp(pt, cont, contLen) == 0) {
290 return j;
291 }
292 }
293 return -1;
294 }
295
297 virtual int lastIndexOf(const char* cont) {
298 if (cont == nullptr) return -1;
299 int contLen = strlen(cont);
300 for (int j = (len - contLen); j >= 0; j--) {
301 if (strncmp(cont, chars + j, contLen) == 0) {
302 return j;
303 }
304 }
305 return -1;
306 }
307
309 virtual int nIndexOf(const char* cont, int n){
310 int result = -1;
311 for (int j=0; j < n; j++){
312 result = indexOf(cont, result + 1);
313 if (result < 0) break;
314 }
315 return result;
316 }
317
319 virtual void operator=(const char* str) { set(str); }
320
322 virtual void operator=(char* str) { set(str); }
323
325 virtual void operator=(char c) { set(c); }
326
328 virtual void operator=(double val) { set(val); }
329
331 virtual void operator=(int value) { set(value); }
332
334 virtual void operator<<(int n) {
335 if (n <= 0 || n > len) return;
336 if (isConst()) {
337 this->chars += n;
338 } else {
339 memmove(this->chars, this->chars + n, len - n + 1);
340 }
341 this->len -= n;
342 }
343
344 virtual char operator[](int index) { return chars[index]; }
345
347 virtual void operator+=(const char* str) { add(str); }
348
350 virtual void operator+=(int value) { add(value); }
351
353 virtual void operator+=(double value) { add(value); }
354
356 virtual void operator+=(const char value) { add(value); }
357
359 virtual bool operator==(const StrView& alt) const {
360 if (this->len != alt.len) return false;
361 return strncmp(this->chars, alt.chars, this->len) == 0;
362 }
363
365 virtual bool operator==(const char* alt) const {
366 return strncmp(this->chars, alt, this->len) == 0;
367 }
368
370 virtual bool operator!=(const StrView& alt) const {
371 return strncmp(this->chars, alt.chars, this->len) != 0;
372 }
373
375 virtual bool operator!=(const char* alt) const {
376 return strncmp(this->chars, alt, this->len) != 0;
377 }
378
380 virtual const char* c_str() { return chars; }
381
384 virtual int length() { return len; }
385
387 virtual bool isEmpty() { return len == 0; }
388
390 virtual int maxLength() { return maxlen; }
391
393 virtual bool replace(const char* toReplace, const char* replaced) {
394 bool result = false;
395 if (toReplace == nullptr || replaced == nullptr) {
396 return result;
397 }
398 if (!isConst()) {
399 int pos = indexOf(toReplace);
400 int old_len = length();
401 int insert_len = 0;
402 if (pos >= 0) {
403 int len_replaced = strlen(replaced);
404 int len_to_replace = strlen(toReplace);
405 insert_len = len_replaced - len_to_replace;
406 grow(this->length() + insert_len);
407 // save remainder and create gap
408 memmove(this->chars + pos + len_replaced,
409 this->chars + pos + len_to_replace,
410 old_len - pos - len_to_replace + 1);
411 // move new string into gap
412 memmove(this->chars + pos, replaced, len_replaced);
413 result = true;
414 len += insert_len;
415 }
416 }
417 return result;
418 }
419
421 virtual bool replaceAll(const char* toReplace, const char* replaced) {
422 if (indexOf(toReplace) == -1) {
423 return false;
424 }
425 while (replace(toReplace, replaced));
426 return true;
427 }
428
430 virtual void remove(const char* toRemove) {
431 if (!isConst() && chars != nullptr) {
432 int removeLen = strlen(toRemove);
433 int pos = indexOf(toRemove);
434 if (pos >= 0) {
435 memmove((void*)(chars + pos), (void*)(chars + pos + removeLen),
436 len - (pos + removeLen) + 1);
437 len -= removeLen;
438 }
439 }
440 }
441
443 virtual void removeAll(const char* toRemove) {
444 if (!isConst() && chars != nullptr) {
445 int removeLen = strlen(toRemove);
446 while (true) {
447 int pos = indexOf(toRemove);
448 if (pos == -1) {
449 break;
450 }
451 memmove((void*)(chars + pos), (void*)(chars + pos + removeLen),
452 len - (pos + removeLen) + 1);
453 len -= removeLen;
454 }
455 }
456 }
457
459 virtual void setLength(int len, bool addZero = true) {
460 if (!isConst() && addZero) {
461 this->savedChar = chars[len];
462 this->savedLen = len;
463 this->len = len;
464 chars[len] = 0;
465 }
466 }
467
469 virtual void setLengthUndo() {
470 if (savedLen >= 0) {
472 this->len = savedLen;
473 savedLen = -1;
474 }
475 }
476
478 virtual void substring(StrView& from, int start, int end) {
479 if (end > start) {
480 int len = end - start;
481 grow(len);
482 if (this->chars != nullptr) {
483 len = len < this->maxlen ? len : this->maxlen;
484 strncpy(this->chars, from.chars + start, len);
485 this->len = len;
486 this->chars[len] = 0;
487 }
488 }
489 }
490
492 virtual void substring(const char* from, int start, int end) {
493 if (end > start) {
494 int len = end - start;
495 grow(len);
496 if (this->chars != nullptr) {
497 strncpy(this->chars, from + start, len);
498 this->chars[len] = 0;
499 this->len = len;
500 }
501 }
502 }
503
505 virtual void trim() {
506 if (chars == nullptr) return;
507 rtrim();
508 ltrim();
509 }
510
512 virtual int count(char c, int startPos) {
513 for (int j = startPos; j < len; j++) {
514 if (chars[j] != c) {
515 return j;
516 }
517 }
518 return 0;
519 }
520
522 virtual void ltrim() {
523 if (chars == nullptr) return;
524 int n = count(' ', 0);
525 if (n > 0) *this << n;
526 }
527
529 virtual void rtrim() {
530 if (chars == nullptr || len == 0) return;
531 if (!isConst()) {
532 while (len > 0 && isspace(chars[len - 1])) {
533 len--;
534 chars[len] = 0;
535 }
536 }
537 }
538
540 virtual void clear() {
541 if (chars != nullptr && !isConst()) {
542 chars[0] = 0;
543 }
544 len = 0;
545 }
546
548 virtual bool isOnHeap() { return false; }
549
551 virtual bool isConst() { return is_const; }
552
554 virtual void insert(int pos, const char* str) {
555 if (!isConst()) {
556 int insert_len = strlen(str);
557 grow(this->length() + insert_len);
558 int move_len = this->len - pos + 1;
559 memmove(chars + pos + insert_len, chars + pos, move_len);
560 strncpy(chars + pos, str, insert_len);
561 }
562 }
563
565 virtual bool equalsIgnoreCase(const char* alt) {
566 if (alt == nullptr) return isEmpty();
567 if ((size_t)len != strlen(alt)) {
568 return false;
569 }
570 for (int j = 0; j < len; j++) {
571 if (tolower(chars[j]) != tolower(alt[j])) return false;
572 }
573 return true;
574 }
575
577 int toInt() {
578 int result = 0;
579 if (!isEmpty()) {
580 result = atoi(chars);
581 }
582 return result;
583 }
584
586 long toLong() {
587 long result = 0;
588 if (!isEmpty()) {
589 result = atol(chars);
590 }
591 return result;
592 }
593
595 double toDouble() {
596 double result = 0;
597 char* eptr;
598 if (!isEmpty()) {
599 result = strtod(chars, &eptr);
600 }
601 return result;
602 }
603
605 float toFloat() {
606 float result = 0;
607 char* eptr;
608 if (!isEmpty()) {
609#ifdef USE_STRTOD
610 result = strtof(chars, &eptr);
611#else
612 result = strtod(chars, &eptr);
613#endif
614 }
615 return result;
616 }
617
619 void toLowerCase() {
620 if (chars != nullptr) {
621 for (int j = 0; j < len; j++) {
622 chars[j] = tolower(chars[j]);
623 }
624 }
625 }
626
628 void toUpperCase() {
629 if (chars != nullptr) {
630 for (int j = 0; j < len; j++) {
631 chars[j] = toupper(chars[j]);
632 }
633 }
634 }
635
637 static const char* toBinary(void const* const ptr, size_t const size) {
638 static char result[160];
639 unsigned char* b = (unsigned char*)ptr;
640 unsigned char byte;
641 int i, j, idx = 0;
642
643 for (i = size - 1; i >= 0; i--) {
644 for (j = 7; j >= 0; j--) {
645 byte = (b[i] >> j) & 1;
646 result[idx++] = byte ? '1' : '0';
647 }
648 }
649 result[idx] = 0;
650 return result;
651 }
652
654 for (int j = 0; j < len; j++) {
655 if (isdigit(chars[j])) {
656 return true;
657 }
658 }
659 return false;
660 }
661
663 bool isInteger() {
664 bool result = containsNumber();
665 int minus_count = 0;
666 for (int j = 0; j < len; j++) {
667 char c = chars[j];
668 if (!isdigit(c)) {
669 switch (c) {
670 case '-':
671 minus_count++;
672 if (minus_count > 1) {
673 result = false;
674 }
675 break;
676 default:
677 result = false;
678 break;
679 }
680 }
681 }
682 return result;
683 }
684
687 int result = 0;
688 int pos = indexOf(".");
689 if (pos >= 0) {
690 for (int j = pos + 1; j < len; j++) {
691 if (isdigit(chars[j])) {
692 pos++;
693 } else {
694 break;
695 }
696 }
697 }
698 return result;
699 }
700
701 // Returns true if the string is a number
702 bool isNumber() {
703 bool result = containsNumber();
704 int dot_count = 0;
705 int minus_count = 0;
706 for (int j = 0; j < len; j++) {
707 char c = chars[j];
708 if (!isdigit(c)) {
709 switch (c) {
710 case '-':
711 minus_count++;
712 if (minus_count > 1) {
713 result = false;
714 }
715 break;
716 case '.':
717 dot_count++;
718 if (dot_count > 1) {
719 result = false;
720 }
721 break;
722 default:
723 result = false;
724 break;
725 }
726 }
727 }
728 return result;
729 }
730
731
732 protected:
733 char* chars = nullptr;
734 bool is_const = false;
735 int len = 0;
736 int maxlen = 0;
737 int savedLen = -1;
739
741 virtual bool grow(int newMaxLen) { return false; }
742
743 static char* itoa(int n, char s[]) {
744 int i, sign;
745 if ((sign = n) < 0) /* record sign */
746 n = -n; /* make n positive */
747 i = 0;
748 do { /* generate digits in reverse order */
749 s[i++] = n % 10 + '0'; /* get next digit */
750 } while ((n /= 10) > 0); /* delete it */
751 if (sign < 0) s[i++] = '-';
752 s[i] = '\0';
753 reverse(s);
754 return s;
755 }
756
757 static void reverse(char s[]) {
758 int i, j;
759 char c;
760
761 for (i = 0, j = strlen(s) - 1; i < j; i++, j--) {
762 c = s[i];
763 s[i] = s[j];
764 s[j] = c;
765 }
766 }
767
768 static char* floatToString(char* outstr, double val, int precision,
769 int widthp) {
770 char temp[16];
771 int i;
772
774 double roundingFactor = 0.5;
775 unsigned long mult = 1;
776 for (i = 0; i < precision; i++) {
777 roundingFactor /= 10.0;
778 mult *= 10;
779 }
780
781 temp[0] = '\0';
782 outstr[0] = '\0';
783
784 if (val < 0.0) {
785 strcpy(outstr, "-\0");
786 val = -val;
787 }
788
789 val += roundingFactor;
790
791 strcat(outstr, itoa(int(val), temp)); // prints the int part
792 if (precision > 0) {
793 strcat(outstr, ".\0");
794 unsigned long frac;
795 unsigned long mult = 1;
796 int padding = precision - 1;
797 while (precision--) mult *= 10;
798
799 if (val >= 0)
800 frac = (val - int(val)) * mult;
801 else
802 frac = (int(val) - val) * mult;
803 unsigned long frac1 = frac;
804
805 while (frac1 /= 10) padding--;
806
807 while (padding--) strcat(outstr, "0\0");
808
809 strcat(outstr, itoa(frac, temp));
810 }
811
813 if ((widthp != 0) && ((size_t)widthp >= strlen(outstr))) {
814 int J = 0;
815 J = widthp - strlen(outstr);
816
817 for (i = 0; i < J; i++) {
818 temp[i] = ' ';
819 }
820
821 temp[i++] = '\0';
822 strcat(temp, outstr);
823 strcpy(outstr, temp);
824 }
825
826 return outstr;
827 }
828
829 static int strncmp_i(const char* s1, const char* s2, int n) {
830 if (n == 0) return (0);
831 do {
832 if (tolower(*s1) != tolower(*s2++))
833 return (*(unsigned char*)s1 - *(unsigned char*)--s2);
834 if (*s1++ == 0) break;
835 } while (--n != 0);
836 return (0);
837 }
838};
839
840} // namespace audio_tools
A simple wrapper to provide string functions on existing allocated char*. If the underlying char* is ...
Definition StrView.h:28
bool is_const
Definition StrView.h:734
static int strncmp_i(const char *s1, const char *s2, int n)
Definition StrView.h:829
static char * floatToString(char *outstr, double val, int precision, int widthp)
Definition StrView.h:768
virtual void operator=(char *str)
we can assign a char*
Definition StrView.h:322
StrView(const char *chars)
Creates a Str for string constant.
Definition StrView.h:33
virtual bool equals(const char *str)
checks if the string equals indicated parameter string
Definition StrView.h:165
virtual bool grow(int newMaxLen)
only supported in subclasses
Definition StrView.h:741
bool containsNumber()
Definition StrView.h:653
int maxlen
Definition StrView.h:736
virtual void set(int value)
Definition StrView.h:85
virtual void operator=(char c)
we can assign a char
Definition StrView.h:325
virtual void operator+=(const char *str)
adds a substring at the end of the string
Definition StrView.h:347
virtual bool endsWith(const char *str)
checks if the string ends with the indicated substring
Definition StrView.h:178
virtual void substring(const char *from, int start, int end)
copies a substring into the current string
Definition StrView.h:492
virtual bool operator!=(const StrView &alt) const
checks if the indicated string is different from the current string
Definition StrView.h:370
bool isInteger()
Returns true if the string is an integer.
Definition StrView.h:663
virtual int length()
Definition StrView.h:384
virtual void operator=(double val)
we can assign a double
Definition StrView.h:328
virtual void set(char chars[], int maxlen, int len=0, bool isConst=false)
assigns a memory buffer
Definition StrView.h:114
virtual bool equalsIgnoreCase(const char *alt)
Compares the string ignoring the case.
Definition StrView.h:565
virtual int maxLength()
provides the maximum length of the string
Definition StrView.h:390
static char * itoa(int n, char s[])
Definition StrView.h:743
virtual bool isOnHeap()
checks if the string is on the heap
Definition StrView.h:548
virtual bool startsWith(const char *str)
checks if the string starts with the indicated substring
Definition StrView.h:171
virtual bool operator==(const char *alt) const
checks if the indicated string is equal to the current string
Definition StrView.h:365
virtual void operator+=(double value)
adds a double at the end of the string
Definition StrView.h:353
virtual bool isEmpty()
checks if the string is empty
Definition StrView.h:387
char * chars
Definition StrView.h:733
virtual void add(const char c)
adds a character
Definition StrView.h:156
virtual int nIndexOf(const char c, int n)
searches for the nth occurence of the indicated character
Definition StrView.h:270
virtual void operator+=(int value)
adds a int at the end of the string
Definition StrView.h:350
double toDouble()
Converts the string to a double.
Definition StrView.h:595
virtual bool operator==(const StrView &alt) const
checks if the indicated string is equal to the current string
Definition StrView.h:359
virtual bool contains(const char *str)
checks if the string contains a substring
Definition StrView.h:280
virtual int lastIndexOf(const char *cont)
provides the position of the last occurrence of the indicated substring
Definition StrView.h:297
virtual void set(double value, int precision=2, int withd=0)
Definition StrView.h:90
virtual void rtrim()
remove trailing spaces
Definition StrView.h:529
virtual bool replaceAll(const char *toReplace, const char *replaced)
Replaces all instances of toReplace with replaced.
Definition StrView.h:421
static void reverse(char s[])
Definition StrView.h:757
virtual void add(const char *append)
adds a string
Definition StrView.h:144
virtual int count(char c, int startPos)
count number of indicated characters as position
Definition StrView.h:512
int numberOfDecimals()
Determines the number of decimals in the number string.
Definition StrView.h:686
virtual void setLength(int len, bool addZero=true)
limits the length of the string (by adding a delimiting 0)
Definition StrView.h:459
virtual void trim()
remove leading and traling spaces
Definition StrView.h:505
virtual void swap(StrView &str)
Definition StrView.h:95
virtual void operator=(int value)
we can assign an int
Definition StrView.h:331
virtual void set(const char *alt)
assigs a value
Definition StrView.h:47
virtual char operator[](int index)
Definition StrView.h:344
virtual void operator+=(const char value)
adds a character
Definition StrView.h:356
int savedLen
Definition StrView.h:737
virtual void operator=(const char *str)
we can assign a const char*
Definition StrView.h:319
virtual bool replace(const char *toReplace, const char *replaced)
Replaces the first instance of toReplace with replaced.
Definition StrView.h:393
StrView(char chars[], int maxlen, int len=0)
Creates a Str with the indicated buffer.
Definition StrView.h:44
virtual void clear()
clears the string by setting the terminating 0 at the beginning
Definition StrView.h:540
long toLong()
Converts the string to an long.
Definition StrView.h:586
virtual void ltrim()
remove leading spaces
Definition StrView.h:522
virtual bool matches(const char *pattern)
Definition StrView.h:193
virtual int nIndexOf(const char *cont, int n)
searches for the nth occurence of the indicated character
Definition StrView.h:309
virtual void substring(StrView &from, int start, int end)
copies a substring into the current string
Definition StrView.h:478
virtual const char * c_str()
provides the string value as const char*
Definition StrView.h:380
float toFloat()
Converts the string to a float.
Definition StrView.h:605
virtual void removeAll(const char *toRemove)
removes the indicated substring from the string
Definition StrView.h:443
virtual void operator<<(int n)
shift characters to the left -> we just move the pointer
Definition StrView.h:334
virtual bool endsWithIgnoreCase(const char *str)
checks if the string ends with the indicated substring
Definition StrView.h:185
virtual void set(const StrView &alt)
assigs from another Str value
Definition StrView.h:66
int toInt()
Converts the string to an int.
Definition StrView.h:577
virtual void add(double value, int precision=2, int withd=0)
adds a double value
Definition StrView.h:135
virtual int indexOf(const char *cont, int start=0)
Definition StrView.h:284
virtual void remove(const char *toRemove)
removes the indicated substring from the string
Definition StrView.h:430
char savedChar
Definition StrView.h:738
virtual bool isConst()
checks if the string is a constant that must not be changed
Definition StrView.h:551
bool isNumber()
Definition StrView.h:702
virtual void insert(int pos, const char *str)
inserts a substring into the string
Definition StrView.h:554
virtual int indexOf(const char c, int start=0)
Definition StrView.h:260
virtual void add(int value)
adds a int value
Definition StrView.h:126
virtual void set(const char c)
Definition StrView.h:80
static const char * toBinary(void const *const ptr, size_t const size)
provides a binary string represntation
Definition StrView.h:637
void toLowerCase()
Converts the string to lowercase letters.
Definition StrView.h:619
virtual void setLengthUndo()
undo the last setLength call
Definition StrView.h:469
void toUpperCase()
Converts the string to uppercase letters.
Definition StrView.h:628
int len
Definition StrView.h:735
virtual bool operator!=(const char *alt) const
checks if the indicated string is different from the current string
Definition StrView.h:375
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition LMSEchoCancellationStream.h:6