MCPcopy Create free account
hub / github.com/PCGen/pcgen / getRightIndex

Method getRightIndex

code/src/java/pcgen/core/RollingMethods.java:116–143  ·  view source on GitHub ↗
(final StringBuilder expression, int startIndex)

Source from the content-addressed store, hash-verified

114 }
115
116 private static int getRightIndex(final StringBuilder expression, int startIndex)
117 {
118 int startIndex1 = startIndex;
119 int parenth = 0;
120 char c;
121 do
122 {
123 startIndex1++;
124 if (startIndex1 < expression.length())
125 {
126 c = expression.charAt(startIndex1);
127 }
128 else
129 {
130 break;
131 }
132 if (c == '(')
133 {
134 parenth++;
135 }
136 else if (c == ')')
137 {
138 parenth--;
139 }
140 }
141 while ((parenth > 0) || (c == '*') || (c == '/') || (c == ' ') || Character.isDigit(c));
142 return startIndex1;
143 }
144
145 /**
146 * Takes many forms including "2d6-2" and returns the result

Callers 1

rollMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected