Numworks Epsilon  1.4.1
Graphing Calculator Operating System
text_input_helpers.cpp
Go to the documentation of this file.
2 #include <string.h>
3 
4 namespace TextInputHelpers {
5 
6 int CursorIndexInCommand(const char * text) {
7  for (size_t i = 0; i < strlen(text)-1; i++) {
8  if (text[i] == '(' || text[i] == '\'') {
9  if (text[i+1] == ')' || text[i+1] == '\'' || text[i+1] == ',') {
10  if (i >= strlen(k_random) && memcmp(&text[i-strlen(k_random)], k_random, strlen(k_random)) == 0) {
11  break;
12  }
13  return i + 1;
14  }
15  }
16  }
17  return strlen(text);
18 }
19 
20 }
size_t strlen(const char *s)
Definition: strlen.c:3
LIBA_BEGIN_DECLS int memcmp(const void *s1, const void *s2, size_t n)
Definition: memcmp.c:3
int CursorIndexInCommand(const char *text)