+ Added compare and info commands

This commit is contained in:
Matthew Cech
2019-05-05 16:38:59 -07:00
parent 55411cfe14
commit 3a8306f1e6
9 changed files with 120 additions and 30 deletions
+3 -13
View File
@@ -1,5 +1,7 @@
package core.rpg;
import utils.StringUtils;
public class RPGInput
{
public String raw;
@@ -16,7 +18,7 @@ public class RPGInput
return;
raw = raw.trim();
int whitespacePos = FindFirstWhitespace(raw);
int whitespacePos = StringUtils.FindFirstWhitespace(raw);
if(whitespacePos == -1)
{
@@ -27,16 +29,4 @@ public class RPGInput
key = raw.substring(0, whitespacePos).trim();
value = raw.substring(whitespacePos).trim();
}
// Finds first whitespace in the string
private int FindFirstWhitespace(String str)
{
for (int i = 0; i < str.length(); ++i)
{
if (Character.isWhitespace(str.charAt(i)))
return i;
}
return -1;
}
}