Need help getting text between sideways carats in java



So I have extracted info from a JSON, but I have come across something I have never seen before. Here are three examples. Each example is actually all one big String, but I split it up just so I could read it better. Now I have never seen anything like this before, except in html.


What I am trying to do is extract the text between the symbols '<>' and '< />'. As you can see there are a bunch of different groups... stats, calc, br, unique, active, passive and i. This is where it also gets a little tricky because I've found that when there is a forward slash, that signifies that one of the groups is finished, but within the stats group, 'br' signifies a new stat.


Could someone explain to me what these sideways carats? are, and how to possible get the information inside of them in Java. I've never seen these things before so I am at a total loss. I tried using the Scanner class, but the strings are not set up in a way that allows me to pick out each individual word. Ill show my scanner output below as well for example 1.


Thank You


Sorry if I did a terrible job at asking this question, I tried to make everything as clear as possible



Example 1)
<stats>
+120 Ability Power
</stats>
<br><br>
<unique>UNIQUE Passive:</unique> Increases Ability Power by 30%."

Example 2)
<stats>
+80 Ability Power<br>
+100% Base Mana Regen (+<calc>round(1*stats[BaseManaRegenRate]*5)</calc> Mana per 5 seconds)<br>
+20% Cooldown Reduction
</stats>
<br><br>
<unique>UNIQUE Passive:</unique> Dealing magic damage to enemy champions below 40% Health inflicts Grievous Wounds for 4 seconds.
<br><br>
<i>(Grievous Wounds reduces incoming healing and regeneration effects by 50%.)</i>"

Example 3)
<stats>
+75 Attack Damage<br>
+100% Base Health Regen (+<calc>round(1*stats[BaseHPRegenRate]*5)</calc> Health per 5 seconds)<br>
+12% Life Steal
</stats>
<br><br>
<passive>Passive:</passive> Life Steal applies to damage dealt by this item.<br>
<unique>UNIQUE Passive - Cleave:</unique> Basic attacks deal 20% to 60% of total Attack Damage as bonus physical damage to enemies near the target on hit (enemies closest to the target take the most damage).<br>
<active>UNIQUE Active - Crescent:</active> Deals 60% to 100% of total Attack Damage as physical damage to nearby enemy units (closest enemies take the most damage) (10 second cooldown).
<br><br>
<i>(Unique Passives with the same name don't stack.)</i>"


my output when I run Scanner.next() on example 1



<stats>+120
Ability
Power
</stats><br><br><unique>UNIQUE
Passive:</unique>
Increases
Ability
Power
by
30%.

No comments:

Post a Comment