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

◆ Utf8NullTerminatedStartsWith()

bool System.Reflection.Internal.MemoryBlock.Utf8NullTerminatedStartsWith ( int offset,
string text,
MetadataStringDecoder utf8Decoder,
char terminator,
bool ignoreCase )
inlinepackage

Definition at line 303 of file MemoryBlock.cs.

304 {
305 int firstDifferenceIndex;
306 switch (Utf8NullTerminatedFastCompare(offset, text, 0, out firstDifferenceIndex, terminator, ignoreCase))
307 {
308 case FastComparisonResult.Equal:
309 case FastComparisonResult.BytesStartWithText:
310 return true;
311 case FastComparisonResult.TextStartsWithBytes:
312 case FastComparisonResult.Unequal:
313 return false;
314 default:
315 {
316 int numberOfBytesRead;
317 string text2 = PeekUtf8NullTerminated(offset, null, utf8Decoder, out numberOfBytesRead, terminator);
318 return text2.StartsWith(text, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
319 }
320 }
321 }
unsafe string PeekUtf8NullTerminated(int offset, byte[]? prefix, MetadataStringDecoder utf8Decoder, out int numberOfBytesRead, char terminator='\0')
unsafe FastComparisonResult Utf8NullTerminatedFastCompare(int offset, string text, int textStart, out int firstDifferenceIndex, char terminator, bool ignoreCase)

References System.offset, System.Reflection.Internal.MemoryBlock.PeekUtf8NullTerminated(), System.text, and System.Reflection.Internal.MemoryBlock.Utf8NullTerminatedFastCompare().

Referenced by System.Reflection.Metadata.Ecma335.StringHeap.StartsWith().