mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-18 07:18:38 +02:00
Refactored script RAM usage to be calculated based on commands. Updated RAM on foreign servers to balance. Balnaced company wages
This commit is contained in:
@@ -71,4 +71,22 @@ function formatNumber(num, numFractionDigits) {
|
||||
minimumFractionDigits: numFractionDigits,
|
||||
maximumFractionDigits: numFractionDigits
|
||||
});
|
||||
}
|
||||
|
||||
//Counters the number of times a substring occurs in a string
|
||||
function numOccurrences(string, subString) {
|
||||
string += "";
|
||||
subString += "";
|
||||
if (subString.length <= 0) return (string.length + 1);
|
||||
|
||||
var n = 0, pos = 0, step = subString.length;
|
||||
|
||||
while (true) {
|
||||
pos = string.indexOf(subString, pos);
|
||||
if (pos >= 0) {
|
||||
++n;
|
||||
pos += step;
|
||||
} else break;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
Reference in New Issue
Block a user