Package net.storm.api.commons
Class JagStrings
java.lang.Object
net.storm.api.commons.JagStrings
Utility class for standardizing game strings from Jagex content.
Game strings often contain formatting tags (like color codes) and non-standard characters. This class provides methods to clean and standardize these strings for consistent comparison and display.
The standardization process involves:
- Removing HTML-like tags (e.g.,
<col=ff0000>) - Sanitizing the string using RuneLite's text utilities
Example usage:
// Standardize a single string
String raw = "<col=ff0000>Dragon dagger</col>";
String clean = JagStrings.standardize(raw); // Returns "Dragon dagger"
// Standardize multiple strings
String[] items = JagStrings.standardize("Item 1", "<col=00ff00>Item 2</col>");
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstandardize(String str) Standardizes a game string by removing tags and sanitizing content.static String[]standardize(String... strs) Standardizes multiple game strings by removing tags and sanitizing content.
-
Constructor Details
-
JagStrings
public JagStrings()
-
-
Method Details
-
standardize
Standardizes a game string by removing tags and sanitizing content.This method removes HTML-like formatting tags commonly found in game text and then sanitizes the result using RuneLite's text utilities.
- Parameters:
str- the string to standardize, may benull- Returns:
- the standardized string, or
nullif the input wasnullor if tag removal resulted innull
-
standardize
Standardizes multiple game strings by removing tags and sanitizing content.Each string in the array is processed individually using
standardize(String).- Parameters:
strs- the strings to standardize, may benull- Returns:
- an array of standardized strings with the same length as the input,
or
nullif the input array wasnull
-