mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2024-11-26 12:15:19 +01:00
Changed words replace from while to for
This commit is contained in:
parent
a2cb93fc6a
commit
c7a4a36699
@ -228,14 +228,13 @@ public class Words {
|
||||
}
|
||||
// remove all "from" and split "words" there
|
||||
String[] splitted = words.split(from);
|
||||
int index = 0;
|
||||
String part;
|
||||
|
||||
// if there are occurences of "from"
|
||||
if (splitted.length > 1) {
|
||||
// - 1 because dont add "to" to the end of last part
|
||||
while (index < splitted.length - 1) {
|
||||
part = splitted[index];
|
||||
for (int i = 0; i < splitted.length - 1; i++) {
|
||||
part = splitted[i];
|
||||
// add current part of "words" to the output
|
||||
newWords = newWords + part;
|
||||
// check if the part ends with correct string
|
||||
@ -247,10 +246,10 @@ public class Words {
|
||||
// add original
|
||||
newWords = newWords + from;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
// add the last part to finish the sentence
|
||||
part = splitted[index];
|
||||
part = splitted[splitted.length - 1];
|
||||
if (part.equals(" ")) {
|
||||
// dont add the space to the end
|
||||
return newWords;
|
||||
@ -298,5 +297,4 @@ public class Words {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user