Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DecodeLastFromUtf16()

static OperationStatus System.Text.Rune.DecodeLastFromUtf16 ( ReadOnlySpan< char > source,
out Rune result,
out int charsConsumed )
inlinestatic

Definition at line 288 of file Rune.cs.

289 {
290 int num = source.Length - 1;
291 if ((uint)num < (uint)source.Length)
292 {
293 char c = source[num];
294 if (TryCreate(c, out result))
295 {
296 charsConsumed = 1;
297 return OperationStatus.Done;
298 }
299 if (char.IsLowSurrogate(c))
300 {
301 num--;
302 if ((uint)num < (uint)source.Length)
303 {
304 char highSurrogate = source[num];
305 if (TryCreate(highSurrogate, c, out result))
306 {
307 charsConsumed = 2;
308 return OperationStatus.Done;
309 }
310 }
311 charsConsumed = 1;
312 result = ReplacementChar;
313 return OperationStatus.InvalidData;
314 }
315 }
316 charsConsumed = -source.Length >>> 31;
317 result = ReplacementChar;
318 return OperationStatus.NeedMoreData;
319 }
static Rune ReplacementChar
Definition Rune.cs:53
static bool TryCreate(char ch, out Rune result)
Definition Rune.cs:511

References System.Text.Rune.ReplacementChar, System.source, and System.Text.Rune.TryCreate().