From 86f6b58d38aa6ccfa8a7f51ec9946d55e790f34c Mon Sep 17 00:00:00 2001 From: chmora Date: Thu, 12 Jan 2017 15:50:39 -0800 Subject: [PATCH] fix"string compare works differently in simulator/on target" (#340) * fix for "string compare works differently in simulator/on target", fixes #901 --- 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 eb30e67d..1dabda5f 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; } //%