PB Unity
commited on
Commit
•
e09c786
1
Parent(s):
998471f
Upload RunJets.cs
Browse files- RunJets.cs +6 -9
RunJets.cs
CHANGED
@@ -134,23 +134,20 @@ public class RunJets : MonoBehaviour
|
|
134 |
{
|
135 |
string output = "";
|
136 |
int start = 0;
|
137 |
-
for (int
|
138 |
{
|
139 |
-
if (
|
140 |
{
|
141 |
start++;
|
142 |
-
|
143 |
continue;
|
144 |
}
|
145 |
-
|
146 |
-
string subword = word.Substring(start, i - start);
|
147 |
if (dict.TryGetValue(subword, out string value))
|
148 |
{
|
149 |
-
// Debug.Log("FOUND");
|
150 |
output += value + " ";
|
151 |
-
|
152 |
-
|
153 |
-
i = word.Length + 1;
|
154 |
}
|
155 |
}
|
156 |
return output;
|
|
|
134 |
{
|
135 |
string output = "";
|
136 |
int start = 0;
|
137 |
+
for (int end = word.Length; end >= 0 && start < word.Length ; end--)
|
138 |
{
|
139 |
+
if (end <= start) //no matches
|
140 |
{
|
141 |
start++;
|
142 |
+
end = word.Length + 1;
|
143 |
continue;
|
144 |
}
|
145 |
+
string subword = word.Substring(start, end - start);
|
|
|
146 |
if (dict.TryGetValue(subword, out string value))
|
147 |
{
|
|
|
148 |
output += value + " ";
|
149 |
+
start = end;
|
150 |
+
end = word.Length + 1;
|
|
|
151 |
}
|
152 |
}
|
153 |
return output;
|