strcpy(str, STRING(o));
m_int ret = -1;
const M_Object obj = *(M_Object*)MEM(SZ_INT);
- if(!obj) {
- *(m_uint*)RETURN = 0;
- return;
- }
const m_str arg = STRING(obj);
const m_int len = strlen(str);
m_int i = 0;
m_int ret = -1;
const m_int start = *(m_int*)MEM(SZ_INT);
const M_Object obj = *(M_Object*)MEM(SZ_INT * 2);
- if(!obj) {
- *(M_Object*)RETURN = NULL;
- return;
- }
const m_str arg = STRING(obj);
const m_int len = strlen(str);
m_int i = start;
m_int ret = -1;
m_int start = *(m_int*)MEM(SZ_INT);
const M_Object obj = *(M_Object*)MEM(SZ_INT * 2);
- if(!obj) {
- *(m_uint*)RETURN = 0;
- return;
- }
m_str arg = STRING(obj);
m_int i = start;
GWI_BB(gwi_func_end(gwi, string_findStart, ae_flag_none))
gwi_func_ini(gwi, "int", "find");
- gwi_func_arg(gwi, "string", "str");
+ gwi_func_arg(gwi, "nonnull string", "str");
GWI_BB(gwi_func_end(gwi, string_findStr, ae_flag_none))
gwi_func_ini(gwi, "int", "find");
gwi_func_arg(gwi, "int", "pos");
- gwi_func_arg(gwi, "string", "str");
+ gwi_func_arg(gwi, "nonnull string", "str");
GWI_BB(gwi_func_end(gwi, string_findStrStart, ae_flag_none))
gwi_func_ini(gwi, "int", "rfind");
GWI_BB(gwi_func_end(gwi, string_rfindStart, ae_flag_none))
gwi_func_ini(gwi, "int", "rfind");
- gwi_func_arg(gwi, "string", "str");
+ gwi_func_arg(gwi, "nonnull string", "str");
GWI_BB(gwi_func_end(gwi, string_rfindStr, ae_flag_none))
gwi_func_ini(gwi, "int", "rfind");
gwi_func_arg(gwi, "int", "pos");
- gwi_func_arg(gwi, "string", "str");
+ gwi_func_arg(gwi, "nonnull string", "str");
GWI_BB(gwi_func_end(gwi, string_rfindStrStart, ae_flag_none))
gwi_func_ini(gwi, "void", "erase");
--- /dev/null
+<<< "test".find('e') >>>;
+<<< "test".find('a') >>>;
+<<< "".find('a') >>>;
+
+<<< "test".find(-1, 'e') >>>;
+<<< "test".find(0, 'e') >>>;
+<<< "test".find(1, 'a') >>>;
+<<< "".find(1, 'a') >>>;
+
+<<< "test".find("es") >>>;
+<<< "test".find("a") >>>;
+<<< "".find("") >>>;
+
+<<< "test".find(-1, "es") >>>;
+<<< "test".find(0, "es") >>>;
+<<< "test".find(1, "a") >>>;
+<<< "".find(1, "") >>>;
+
+<<< "test".rfind("es") >>>;
+<<< "test".rfind("a") >>>;
+<<< "".rfind("") >>>;
+
+<<< "test".rfind(-1, "es") >>>;
+<<< "test".rfind(0, "e") >>>;
+<<< "test".rfind(1, "a") >>>;
+<<< "".rfind(1, "") >>>;