127 {
128 number.scale = 0;
129 number.sign = false;
132 bool flag = false;
133 string str2;
134 string str3;
136 {
137 text = numfmt.CurrencySymbol;
138 str2 = numfmt.CurrencyDecimalSeparator;
139 str3 = numfmt.CurrencyGroupSeparator;
140 flag = true;
141 }
142 else
143 {
144 str2 = numfmt.NumberDecimalSeparator;
145 str3 = numfmt.NumberGroupSeparator;
146 }
147 int num = 0;
148 bool flag2 = sb != null;
149 int num2 = (flag2 ? int.MaxValue : 32);
151 char c = ((ptr < strEnd) ? (*ptr) : '\0');
152 char* digits = number.digits;
153 while (true)
154 {
155 if (!
IsWhite(c) || (
options &
NumberStyles.AllowLeadingWhite) == 0 || (((uint)num & (
true ? 1u : 0u)) != 0 && (num & 0x20) == 0 && numfmt.NumberNegativePattern != 2))
156 {
157 char* ptr2;
158 if ((
options &
NumberStyles.AllowLeadingSign) != 0 && (num & 1) == 0 && ((ptr2 =
MatchChars(ptr, strEnd, numfmt.PositiveSign)) !=
null || ((ptr2 =
MatchNegativeSignChars(ptr, strEnd, numfmt.NegativeSign, allowHyphenDuringParsing)) !=
null && (number.sign =
true))))
159 {
160 num |= 1;
161 ptr = ptr2 - 1;
162 }
164 {
165 num |= 3;
166 number.sign = true;
167 }
168 else
169 {
171 {
172 break;
173 }
174 num |= 0x20;
176 ptr = ptr2 - 1;
177 }
178 }
179 c = ((++ptr < strEnd) ? (*ptr) : '\0');
180 }
181 int num3 = 0;
182 int num4 = 0;
183 while (true)
184 {
185 char* ptr2;
186 if ((c >=
'0' && c <=
'9') || ((
options &
NumberStyles.AllowHexSpecifier) != 0 && ((c >=
'a' && c <=
'f') || (c >=
'A' && c <=
'F'))))
187 {
188 num |= 4;
189 if (c !=
'0' || ((uint)num & 8u) != 0 || (flag2 && (
options &
NumberStyles.AllowHexSpecifier) != 0))
190 {
191 if (num3 < num2)
192 {
193 if (flag2)
194 {
196 }
197 else
198 {
199 digits[num3++] = c;
200 }
201 if (c != '0' || parseDecimal)
202 {
203 num4 = num3;
204 }
205 }
206 if ((num & 0x10) == 0)
207 {
208 number.scale++;
209 }
210 num |= 8;
211 }
212 else if (((uint)num & 0x10u) != 0)
213 {
214 number.scale--;
215 }
216 }
217 else if ((
options &
NumberStyles.AllowDecimalPoint) != 0 && (num & 0x10) == 0 && ((ptr2 =
MatchChars(ptr, strEnd, str2)) !=
null || (flag && (num & 0x20) == 0 && (ptr2 =
MatchChars(ptr, strEnd, numfmt.NumberDecimalSeparator)) !=
null)))
218 {
219 num |= 0x10;
220 ptr = ptr2 - 1;
221 }
222 else
223 {
224 if ((
options &
NumberStyles.AllowThousands) == 0 || (num & 4) == 0 || ((uint)num & 0x10u) != 0 || ((ptr2 =
MatchChars(ptr, strEnd, str3)) ==
null && (!flag || ((uint)num & 0x20u) != 0 || (ptr2 =
MatchChars(ptr, strEnd, numfmt.NumberGroupSeparator)) ==
null)))
225 {
226 break;
227 }
228 ptr = ptr2 - 1;
229 }
230 c = ((++ptr < strEnd) ? (*ptr) : '\0');
231 }
232 bool flag3 = false;
233 number.precision = num4;
234 if (flag2)
235 {
237 }
238 else
239 {
240 digits[num4] = '\0';
241 }
242 if (((uint)num & 4u) != 0)
243 {
245 {
246 char* ptr3 = ptr;
247 c = ((++ptr < strEnd) ? (*ptr) : '\0');
248 char* ptr2;
249 if ((ptr2 =
MatchChars(ptr, strEnd, numfmt.PositiveSign)) !=
null)
250 {
251 c = (((ptr = ptr2) < strEnd) ? (*ptr) : '\0');
252 }
253 else if ((ptr2 =
MatchNegativeSignChars(ptr, strEnd, numfmt.NegativeSign, allowHyphenDuringParsing)) !=
null)
254 {
255 c = (((ptr = ptr2) < strEnd) ? (*ptr) : '\0');
256 flag3 = true;
257 }
258 if (c >= '0' && c <= '9')
259 {
260 int num5 = 0;
261 do
262 {
263 num5 = num5 * 10 + (c - 48);
264 c = ((++ptr < strEnd) ? (*ptr) : '\0');
265 if (num5 > 1000)
266 {
267 num5 = 9999;
268 while (c >= '0' && c <= '9')
269 {
270 c = ((++ptr < strEnd) ? (*ptr) : '\0');
271 }
272 }
273 }
274 while (c >= '0' && c <= '9');
275 if (flag3)
276 {
277 num5 = -num5;
278 }
279 number.scale += num5;
280 }
281 else
282 {
283 ptr = ptr3;
284 c = ((ptr < strEnd) ? (*ptr) : '\0');
285 }
286 }
287 while (true)
288 {
290 {
291 char* ptr2;
292 if ((
options &
NumberStyles.AllowTrailingSign) != 0 && (num & 1) == 0 && ((ptr2 =
MatchChars(ptr, strEnd, numfmt.PositiveSign)) !=
null || ((ptr2 =
MatchNegativeSignChars(ptr, strEnd, numfmt.NegativeSign, allowHyphenDuringParsing)) !=
null && (number.sign =
true))))
293 {
294 num |= 1;
295 ptr = ptr2 - 1;
296 }
297 else if (c == ')' && ((uint)num & 2u) != 0)
298 {
299 num &= -3;
300 }
301 else
302 {
304 {
305 break;
306 }
308 ptr = ptr2 - 1;
309 }
310 }
311 c = ((++ptr < strEnd) ? (*ptr) : '\0');
312 }
313 if ((num & 2) == 0)
314 {
315 if ((num & 8) == 0)
316 {
317 if (!parseDecimal)
318 {
319 number.scale = 0;
320 }
321 if ((num & 0x10) == 0)
322 {
323 number.sign = false;
324 }
325 }
327 return true;
328 }
329 }
331 return false;
332 }
StringBuilder Append(char value, int repeatCount)