MCPcopy Create free account
hub / github.com/akeranen/the-one / valueFillString

Method valueFillString

core/Settings.java:852–875  ·  view source on GitHub ↗

Fills a String formatted in a special way with values from Settings. String can contain (fully qualified) setting names surrounded by delimiters (see #FILL_DELIMITER). Values for those settings are retrieved and filled in the place of place holders. @param input The input string that may con

(String input)

Source from the content-addressed store, hash-verified

850 * @throws SettingsError if such settings were not found
851 */
852 public String valueFillString(String input) {
853 if (!input.contains(FILL_DELIMITER)) {
854 return input; // nothing to fill
855 }
856
857 Settings s = new Settings(); // don't use any namespace
858 String result = "";
859 Scanner scan = new Scanner(input);
860 scan.useDelimiter(FILL_DELIMITER);
861
862 if (input.startsWith(FILL_DELIMITER)) {
863 result += s.getSetting(scan.next());
864 }
865
866 while(scan.hasNext()) {
867 result += scan.next();
868 if (!scan.hasNext()) {
869 break;
870 }
871 result += s.getSetting(scan.next());
872 }
873
874 return result;
875 }
876
877 /**
878 * Returns a String representation of the stored settings

Callers 4

SimScenarioMethod · 0.95
ReportMethod · 0.95
testValueFillStringMethod · 0.80
ExternalEventsQueueMethod · 0.80

Calls 4

getSettingMethod · 0.95
containsMethod · 0.80
nextMethod · 0.80
hasNextMethod · 0.80

Tested by 1

testValueFillStringMethod · 0.64