From 4cf742902d921de85cc405e51e28d35ce4b5985a Mon Sep 17 00:00:00 2001 From: otya128 Date: Tue, 20 Dec 2016 21:40:11 +0900 Subject: [PATCH] Fix INSTR --- SMILEBASIC/builtinfunctions.d | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SMILEBASIC/builtinfunctions.d b/SMILEBASIC/builtinfunctions.d index 978b675..1ac07b6 100644 --- a/SMILEBASIC/builtinfunctions.d +++ b/SMILEBASIC/builtinfunctions.d @@ -1228,7 +1228,11 @@ class BuiltinFunction str1 = vstart.castDString; str2 = vstr1.castDString; } - return cast(int)(str1[start..$].indexOf(str2, CaseSensitive.no)); + ptrdiff_t index = str1[start..$].indexOf(str2); + if (index == -1) + return -1; + else + return cast(int)(index + start); } static int ASC(wstring str) {