stringH
library
Classes
-
Bracket
-
A container to record the starting and ending bracket characters
-
StrPos
-
Object to record the start and end positions in a string
Functions
-
bracketPositionLeft(String source, BracketType bracketType)
→ Option<StrPos>
-
Finds the brackets furthest to the left '(L) (R)'
Returns a start and end position
inp: bl(blim) (plumpy(stumpy))
out: 2, 7
-
bracketPositionRight(String source, BracketType bracketType)
→ Option<StrPos>
-
Finds the brackets furthest to the right '(L) (R)'
Returns a start and end position
inp: bl(blim) (plumpy(stumpy))
out: 10, 24;
-
createSpaces(int number)
→ String
-
Creates a string of the determined number of spaces
inp: 5
out: " "
-
findOutsideOfBrackets(BracketType bracketType, String source, String pattern)
→ List<int>
-
Gets the starting positions of the pattern inside brackets
inp: aaa,aaaa<aa,a,>aa,a |
out:
3,17
-
firstWord(String source)
→ String?
-
Gets the first full word from the beginning of the text
delimited by a space
inp: blah
-
getBracket(BracketType bracketType)
→ Bracket
-
Gets the related bracket data line for the bracket type
-
getInBracketsRight(String input, BracketType bracketType)
→ Option<String>
-
Finds the brackets furthest to the right '(L) (R)'
inp: bl(blim) (plumpy(stumpy))
out: (plumpy(stumpy))
-
removePunctuation(String input)
→ String
-
Replace all punctuation with a space
replace any spaces with just one char
Trim any spaces from end and beginning of word
,.;@#?!&$
-
splitByIndices(String source, List<int> positions)
→ List<String>
-
Splits a string at the indices passed in
-
splitByLastOf(String source, String pattern)
→ List<String>
-
Splits a string into two where it finds the pattern
closest to the right of the string
inp: "this is a test", " "
out:
"this is a", "test"