From 8c2ecdd42ea2686db1548a6a61fd80b52ec72ab2 Mon Sep 17 00:00:00 2001 From: Sam El-Husseini Date: Thu, 12 Jan 2017 16:14:15 -0800 Subject: [PATCH] fix"string compare works differently in simulator/on target" --- libs/core/core.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/core/core.cpp b/libs/core/core.cpp index 0e68ea36..890d763a 100644 --- a/libs/core/core.cpp +++ b/libs/core/core.cpp @@ -21,7 +21,12 @@ namespace String_ { //% int compare(StringData *s, StringData *that) { - return strcmp(s->data, that->data); + int compareResult = strcmp(s->data, that->data); + if (compareResult < 0) + return -1; + else if (compareResult > 0) + return 1; + return 0; } //%