Class JagStrings

java.lang.Object
net.storm.api.commons.JagStrings

public class JagStrings extends Object
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:

  1. Removing HTML-like tags (e.g., <col=ff0000>)
  2. 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:
  • Text
  • Constructor Details

    • JagStrings

      public JagStrings()
  • Method Details

    • standardize

      public static String standardize(String str)
      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 be null
      Returns:
      the standardized string, or null if the input was null or if tag removal resulted in null
    • standardize

      public static String[] standardize(String... strs)
      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 be null
      Returns:
      an array of standardized strings with the same length as the input, or null if the input array was null