Package com.j3d.utility
Class Parsing
java.lang.Object
com.j3d.utility.Parsing
Parsing utilities used by
Programming Language}, my custom
personal project.
CommandParser. This code is borrowed from the
invalid @linkplain
{@linkplain <a href="https://github.com/yetnt/jaiva">Jaiva
This was abstracted from Jaiva as to not import the entire language runtime and parser for it's utilities and to remove parsing quirks that the Jaiva methods would've introduced.
- Author:
- Lehlogonolo Poole
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA record to hold the results of thebracePairs(String)method. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Parsing.BracePairsbracePairs(String line) Finds matching brace pairs (parentheses and square brackets) within a given line of text.quotationPairs(String line) Finds pairs of double quotation marks within a given line of text, ignoring escaped quotation marks.static StringremoveHTML(String input) Removes HTML tags from the input string.Splits a string by a given character, ignoring delimiters within quotation marks or brace pairs.static StringtoCamelCase(String input) Converts a given string to camelCase.
-
Constructor Details
-
Parsing
public Parsing()
-
-
Method Details
-
quotationPairs
Finds pairs of double quotation marks within a given line of text, ignoring escaped quotation marks. -
bracePairs
Finds matching brace pairs (parentheses and square brackets) within a given line of text. It also returns any unclosed braces. -
toCamelCase
Converts a given string to camelCase. It handles spaces and underscores as delimiters, converting the character following them to uppercase.- Parameters:
input- The string to convert to camelCase.- Returns:
- The camelCase version of the input string.
-
removeHTML
Removes HTML tags from the input string. This method iterates through the string and appends characters to the result only if they are not enclosed within '<' and '>' characters.- Parameters:
input- The string from which to remove HTML tags.- Returns:
- A new string with all HTML tags removed.
-
split
Splits a string by a given character, ignoring delimiters within quotation marks or brace pairs. This method handles nested braces and quotes.- Parameters:
input- The string to be split.c- The character to split the string by.- Returns:
- An
ArrayListof strings, where each string is a segment of the input string.
-