Skip to content
This repository was archived by the owner on Oct 30, 2019. It is now read-only.

CodeParser

cezarmathe edited this page Jun 21, 2019 · 3 revisions

CodeParser is a class that does CodeParsing for you, parsing an input String and returning an ArrayList<Code>(sorted as the different CodeTypes appear in the input String).

Fields

  • codeTypes the list of CodeTypes that the parser should be looking for

Methods

  • addCodeType() add a new CodeType to the list of CodeTypes that should be checked; if adding a CodeType twice, a RuntimeException will be thrown
  • parseString() parse an input String for the given CodeTypes and return a sorted ArrayList<Code>

Examples

Parse an input String

The input String:

<1111@adasdasdas!823ijkdw>
4m3kf<ab12>  da<123B@cezar
mathe>  da878uqijkauhcz< ad>>d
aa,<<ad a,<1111@numele meu!qudad
jas22>
ArrayList<Code> parsedList = codeParser
                .addCodeType(CodeType.PRIVATE)
                .addCodeType(CodeType.PUBLIC_NO_PASSCODE)
                .addCodeType(CodeType.PUBLIC_WITH_PASSCODE)
                .parseString("the text from above ^");
System.out.println(parsedList); // prints [<1111@adasdasdas!823ijkdw>, <ab12>, <123B@cezarmathe>, <1111@numelemeu!qudadjas22>]

Clone this wiki locally