203 instantiations of StringSegment
Microsoft.AspNetCore.Components (3)
Microsoft.AspNetCore.HostFiltering (1)
Microsoft.AspNetCore.Http (1)
Microsoft.AspNetCore.Http.Abstractions (2)
Microsoft.AspNetCore.Mvc.Abstractions (3)
Microsoft.AspNetCore.Mvc.Core (35)
Formatters\MediaType.cs (9)
18private static readonly StringSegment QualityParameter = new StringSegment("q");
194return ReplaceEncoding(new StringSegment(mediaType), encoding);
239return GetEncoding(new StringSegment(mediaType));
294new StringSegment(mediaType, start, parser.CurrentOffset - start),
359var asterisk = new StringSegment("*");
392name = new StringSegment(input, current, nameLength);
421value = new StringSegment(input, current + 1, valueLength - 2);
425value = new StringSegment(input, current, valueLength);
454return HasName(new StringSegment(name));
src\Shared\MediaType\ReadOnlyMediaTypeHeaderValue.cs (18)
46Type = new StringSegment();
47SubType = new StringSegment();
48SubTypeWithoutSuffix = new StringSegment();
49SubTypeSuffix = new StringSegment();
60SubType = new StringSegment();
61SubTypeWithoutSuffix = new StringSegment();
62SubTypeSuffix = new StringSegment();
77SubTypeSuffix = new StringSegment();
107type = new StringSegment(input, current, typeLength);
136subType = new StringSegment(input, current, subtypeLength);
276return GetParameter(new StringSegment(parameterName));
299return new StringSegment();
333return GetEncoding(new StringSegment(mediaType));
511var asterisk = new StringSegment("*");
544name = new StringSegment(input, current, nameLength);
573value = new StringSegment(input, current + 1, valueLength - 2);
577value = new StringSegment(input, current, valueLength);
606return HasName(new StringSegment(name));
Microsoft.AspNetCore.Mvc.Core.Test (77)
Formatters\AcceptHeaderParserTest.cs (11)
17new MediaTypeSegmentWithQuality(new StringSegment("application/json"),1.0)
34new MediaTypeSegmentWithQuality(new StringSegment("application/json"),1.0),
35new MediaTypeSegmentWithQuality(new StringSegment("application/xml;q=0.8"),0.8)
56new MediaTypeSegmentWithQuality(new StringSegment("application/json"),1.0),
57new MediaTypeSegmentWithQuality(new StringSegment("application/xml"),1.0),
95var expectedMediaTypes = expected.Select(e => new MediaTypeSegmentWithQuality(new StringSegment(e), 1.0)).ToList();
110new MediaTypeSegmentWithQuality(new StringSegment("application/json"), 1.0),
111new MediaTypeSegmentWithQuality(new StringSegment("application/xml;q=0.8"), 0.8)
160new MediaTypeSegmentWithQuality(new StringSegment("*/*Content-Type"), 1.0),
161new MediaTypeSegmentWithQuality(new StringSegment("application/json"), 1.0),
179new MediaTypeSegmentWithQuality(new StringSegment("application/json"), 1.0),
Formatters\MediaTypeTest.cs (14)
21Assert.Equal(new StringSegment("application"), result.Type);
22Assert.Equal(new StringSegment("json"), result.SubType);
52Assert.Equal(new StringSegment(expectedSubTypeWithoutSuffix), result.SubTypeWithoutSuffix);
53Assert.Equal(new StringSegment(expectedSubtypeSuffix), result.SubTypeSuffix);
85Assert.Equal(new StringSegment("application"), result.Type);
86Assert.Equal(new StringSegment("json+bson"), result.SubType);
87Assert.Equal(new StringSegment("json"), result.SubTypeWithoutSuffix);
88Assert.Equal(new StringSegment("bson"), result.SubTypeSuffix);
89Assert.Equal(new StringSegment("pretty"), result.GetParameter("format"));
90Assert.Equal(new StringSegment("0.8"), result.GetParameter("q"));
91Assert.Equal(new StringSegment("utf-8"), result.GetParameter("charset"));
101Assert.Equal(new StringSegment("ediaType"), result.Type);
157var expectedParameter = new StringSegment("utf-8");
186var expectedParameter = new StringSegment("utf-8");
Microsoft.AspNetCore.Mvc.Core.TestCommon (4)
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (8)
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (8)
Microsoft.AspNetCore.Mvc.TagHelpers (3)
Microsoft.AspNetCore.Owin (1)
Microsoft.AspNetCore.Routing (21)
src\Shared\MediaType\ReadOnlyMediaTypeHeaderValue.cs (18)
46Type = new StringSegment();
47SubType = new StringSegment();
48SubTypeWithoutSuffix = new StringSegment();
49SubTypeSuffix = new StringSegment();
60SubType = new StringSegment();
61SubTypeWithoutSuffix = new StringSegment();
62SubTypeSuffix = new StringSegment();
77SubTypeSuffix = new StringSegment();
107type = new StringSegment(input, current, typeLength);
136subType = new StringSegment(input, current, subtypeLength);
276return GetParameter(new StringSegment(parameterName));
299return new StringSegment();
333return GetEncoding(new StringSegment(mediaType));
511var asterisk = new StringSegment("*");
544name = new StringSegment(input, current, nameLength);
573value = new StringSegment(input, current + 1, valueLength - 2);
577value = new StringSegment(input, current, valueLength);
606return HasName(new StringSegment(name));
Microsoft.AspNetCore.Routing.Tests (18)
PathTokenizerTest.cs (18)
19{ "//", new StringSegment[] { new StringSegment("//", 1, 0) } },
24new StringSegment("///", 1, 0),
25new StringSegment("///", 2, 0),
32new StringSegment("////", 1, 0),
33new StringSegment("////", 2, 0),
34new StringSegment("////", 3, 0),
37{ "/zero", new StringSegment[] { new StringSegment("/zero", 1, 4) } },
38{ "/zero/", new StringSegment[] { new StringSegment("/zero/", 1, 4) } },
43new StringSegment("/zero/one", 1, 4),
44new StringSegment("/zero/one", 6, 3),
51new StringSegment("/zero/one/", 1, 4),
52new StringSegment("/zero/one/", 6, 3),
59new StringSegment("/zero/one/two", 1, 4),
60new StringSegment("/zero/one/two", 6, 3),
61new StringSegment("/zero/one/two", 10, 3),
68new StringSegment("/zero/one/two/", 1, 4),
69new StringSegment("/zero/one/two/", 6, 3),
70new StringSegment("/zero/one/two/", 10, 3),
Microsoft.AspNetCore.Server.HttpSys (2)
Microsoft.AspNetCore.Server.IIS (2)
Microsoft.AspNetCore.Shared.Tests (2)
Microsoft.AspNetCore.WebUtilities (1)
Microsoft.Extensions.FileProviders.Embedded (1)
Microsoft.Extensions.Primitives (2)
Microsoft.Net.Http.Headers (2)
Microsoft.Net.Http.Headers.Tests (6)
855 references to StringSegment
Aspire.Dashboard (2)
Microsoft.AspNetCore.Authentication.Test (3)
Microsoft.AspNetCore.Components (10)
Microsoft.AspNetCore.Components.WebAssembly.Server (14)
Microsoft.AspNetCore.Grpc.JsonTranscoding (3)
Microsoft.AspNetCore.HostFiltering (4)
Microsoft.AspNetCore.Http (26)
src\Http\Shared\CookieHeaderParserShared.cs (17)
37if (parsedName == null || StringSegment.IsNullOrEmpty(parsedName.Value)
38|| parsedValue == null || StringSegment.IsNullOrEmpty(parsedValue.Value))
59public static bool TryParseValue(StringSegment value, ref int index, bool supportsMultipleValues, [NotNullWhen(true)] out StringSegment? parsedName, [NotNullWhen(true)] out StringSegment? parsedValue)
69if (StringSegment.IsNullOrEmpty(value) || (index == value.Length))
108private static int GetNextNonEmptyOrWhitespaceIndex(StringSegment input, int startIndex, bool skipEmptyValues, out bool separatorFound)
140internal static bool TryGetCookieLength(StringSegment input, ref int offset, [NotNullWhen(true)] out StringSegment? parsedName, [NotNullWhen(true)] out StringSegment? parsedValue)
147if (StringSegment.IsNullOrEmpty(input) || (offset >= input.Length))
182internal static StringSegment GetCookieValue(StringSegment input, ref int offset)
191return StringSegment.Empty;
216return StringSegment.Empty;
227return StringSegment.Empty;
230private static bool ReadEqualsSign(StringSegment input, ref int offset)
src\Shared\HttpRuleParser.cs (7)
54internal static int GetTokenLength(StringSegment input, int startIndex)
68internal static int GetWhitespaceLength(StringSegment input, int startIndex)
111internal static int GetNumberLength(StringSegment input, int startIndex, bool allowDecimal)
155internal static HttpParseResult GetQuotedStringLength(StringSegment input, int startIndex, out int length)
163internal static HttpParseResult GetQuotedPairLength(StringSegment input, int startIndex, out int length)
187internal static bool TryStringToDate(StringSegment input, out DateTimeOffset result)
211StringSegment input,
Microsoft.AspNetCore.Http.Abstractions (25)
HostString.cs (18)
95GetParts(_value, out var host, out _);
109GetParts(_value, out _, out var port);
111if (!StringSegment.IsNullOrEmpty(port)
147GetParts(_value, out var host, out var port);
151return StringSegment.IsNullOrEmpty(port)
225public static bool MatchesAny(StringSegment value, IList<StringSegment> patterns)
234GetParts(value, out var host, out var port);
247var pattern = patterns[i];
254if (StringSegment.Equals(pattern, host, StringComparison.OrdinalIgnoreCase))
263var allowedRoot = pattern.Subsegment(1);
265var hostRoot = host.Subsegment(host.Length - allowedRoot.Length);
341private static void GetParts(StringSegment value, out StringSegment host, out StringSegment port)
347if (StringSegment.IsNullOrEmpty(value))
Microsoft.AspNetCore.Http.Abstractions.Tests (3)
Microsoft.AspNetCore.Http.Extensions (9)
Microsoft.AspNetCore.Http.Microbenchmarks (2)
Microsoft.AspNetCore.HttpOverrides (2)
Microsoft.AspNetCore.HttpsPolicy (4)
Microsoft.AspNetCore.Localization (19)
Microsoft.AspNetCore.Mvc.Abstractions (11)
Microsoft.AspNetCore.Mvc.Core (87)
Formatters\MediaType.cs (31)
18private static readonly StringSegment QualityParameter = new StringSegment("q");
34/// <param name="mediaType">The <see cref="StringSegment"/> with the media type.</param>
35public MediaType(StringSegment mediaType)
77public StringSegment Type => _mediaTypeHeaderValue.Type;
91public StringSegment SubType => _mediaTypeHeaderValue.SubType;
100public StringSegment SubTypeWithoutSuffix => _mediaTypeHeaderValue.SubTypeWithoutSuffix;
109public StringSegment SubTypeSuffix => _mediaTypeHeaderValue.SubTypeSuffix;
141public StringSegment Charset => _mediaTypeHeaderValue.Charset;
167/// The <see cref="StringSegment"/>for the given <paramref name="parameterName"/> if found; otherwise
170public StringSegment GetParameter(string parameterName)
178/// The <see cref="StringSegment"/>for the given <paramref name="parameterName"/> if found; otherwise
181public StringSegment GetParameter(StringSegment parameterName)
205public static string ReplaceEncoding(StringSegment mediaType, Encoding encoding)
208var charset = parsedMediaType.GetParameter("charset");
247public static Encoding? GetEncoding(StringSegment mediaType)
266if (parsedMediaType.Type.Equals(default(StringSegment)) ||
267parsedMediaType.SubType.Equals(default(StringSegment)))
298private static string CreateMediaTypeWithEncoding(StringSegment mediaType, Encoding encoding)
349var nameLength = GetNameLength(input, startIndex, out var name);
359var asterisk = new StringSegment("*");
370var valueLength = GetValueLength(input, current, out var value);
378private static int GetNameLength(string input, int startIndex, out StringSegment name)
388name = default(StringSegment);
400private static int GetValueLength(string input, int startIndex, out StringSegment value)
416value = default(StringSegment);
442public MediaTypeParameter(StringSegment name, StringSegment value)
448public StringSegment Name { get; }
450public StringSegment Value { get; }
457public bool HasName(StringSegment name)
src\Shared\HttpRuleParser.cs (7)
54internal static int GetTokenLength(StringSegment input, int startIndex)
68internal static int GetWhitespaceLength(StringSegment input, int startIndex)
111internal static int GetNumberLength(StringSegment input, int startIndex, bool allowDecimal)
155internal static HttpParseResult GetQuotedStringLength(StringSegment input, int startIndex, out int length)
163internal static HttpParseResult GetQuotedPairLength(StringSegment input, int startIndex, out int length)
187internal static bool TryStringToDate(StringSegment input, out DateTimeOffset result)
211StringSegment input,
src\Shared\MediaType\ReadOnlyMediaTypeHeaderValue.cs (37)
27/// <param name="mediaType">The <see cref="StringSegment"/> with the media type.</param>
28public ReadOnlyMediaTypeHeaderValue(StringSegment mediaType)
43var typeLength = GetTypeLength(mediaType, offset, out var type);
57var subTypeLength = GetSubtypeLength(mediaType, offset + typeLength, out var subType);
89private static int GetTypeLength(string input, int offset, out StringSegment type)
93type = default(StringSegment);
103type = default(StringSegment);
115private static int GetSubtypeLength(string input, int offset, out StringSegment subType)
122subType = default(StringSegment);
132subType = default(StringSegment);
144private static bool TryGetSuffixLength(StringSegment subType, out int suffixLength)
167public StringSegment Type { get; }
181public StringSegment SubType { get; }
190public StringSegment SubTypeWithoutSuffix { get; }
199public StringSegment SubTypeSuffix { get; }
231public StringSegment Charset => GetParameter("charset");
271/// The <see cref="StringSegment"/>for the given <paramref name="parameterName"/> if found; otherwise
274public StringSegment GetParameter(string parameterName)
284/// The <see cref="StringSegment"/>for the given <paramref name="parameterName"/> if found; otherwise
287public StringSegment GetParameter(StringSegment parameterName)
310public bool TryGetLastParameter(StringSegment parameterName, out StringSegment parameterValue)
341public static Encoding? GetEncoding(StringSegment mediaType)
347private static Encoding? GetEncodingFromCharset(StringSegment charset)
501var nameLength = GetNameLength(input, startIndex, out var name);
511var asterisk = new StringSegment("*");
522var valueLength = GetValueLength(input, current, out var value);
530private static int GetNameLength(string input, int startIndex, out StringSegment name)
540name = default(StringSegment);
552private static int GetValueLength(string input, int startIndex, out StringSegment value)
568value = default(StringSegment);
594public MediaTypeParameter(StringSegment name, StringSegment value)
600public StringSegment Name { get; }
602public StringSegment Value { get; }
609public bool HasName(StringSegment name)
Microsoft.AspNetCore.Mvc.Core.Test (23)
Microsoft.AspNetCore.Mvc.Core.TestCommon (4)
Microsoft.AspNetCore.Mvc.TagHelpers (17)
Microsoft.AspNetCore.OutputCaching (1)
Microsoft.AspNetCore.ResponseCaching (1)
Microsoft.AspNetCore.ResponseCompression (4)
Microsoft.AspNetCore.Routing (54)
src\Shared\HttpRuleParser.cs (7)
54internal static int GetTokenLength(StringSegment input, int startIndex)
68internal static int GetWhitespaceLength(StringSegment input, int startIndex)
111internal static int GetNumberLength(StringSegment input, int startIndex, bool allowDecimal)
155internal static HttpParseResult GetQuotedStringLength(StringSegment input, int startIndex, out int length)
163internal static HttpParseResult GetQuotedPairLength(StringSegment input, int startIndex, out int length)
187internal static bool TryStringToDate(StringSegment input, out DateTimeOffset result)
211StringSegment input,
src\Shared\MediaType\ReadOnlyMediaTypeHeaderValue.cs (37)
27/// <param name="mediaType">The <see cref="StringSegment"/> with the media type.</param>
28public ReadOnlyMediaTypeHeaderValue(StringSegment mediaType)
43var typeLength = GetTypeLength(mediaType, offset, out var type);
57var subTypeLength = GetSubtypeLength(mediaType, offset + typeLength, out var subType);
89private static int GetTypeLength(string input, int offset, out StringSegment type)
93type = default(StringSegment);
103type = default(StringSegment);
115private static int GetSubtypeLength(string input, int offset, out StringSegment subType)
122subType = default(StringSegment);
132subType = default(StringSegment);
144private static bool TryGetSuffixLength(StringSegment subType, out int suffixLength)
167public StringSegment Type { get; }
181public StringSegment SubType { get; }
190public StringSegment SubTypeWithoutSuffix { get; }
199public StringSegment SubTypeSuffix { get; }
231public StringSegment Charset => GetParameter("charset");
271/// The <see cref="StringSegment"/>for the given <paramref name="parameterName"/> if found; otherwise
274public StringSegment GetParameter(string parameterName)
284/// The <see cref="StringSegment"/>for the given <paramref name="parameterName"/> if found; otherwise
287public StringSegment GetParameter(StringSegment parameterName)
310public bool TryGetLastParameter(StringSegment parameterName, out StringSegment parameterValue)
341public static Encoding? GetEncoding(StringSegment mediaType)
347private static Encoding? GetEncodingFromCharset(StringSegment charset)
501var nameLength = GetNameLength(input, startIndex, out var name);
511var asterisk = new StringSegment("*");
522var valueLength = GetValueLength(input, current, out var value);
530private static int GetNameLength(string input, int startIndex, out StringSegment name)
540name = default(StringSegment);
552private static int GetValueLength(string input, int startIndex, out StringSegment value)
568value = default(StringSegment);
594public MediaTypeParameter(StringSegment name, StringSegment value)
600public StringSegment Name { get; }
602public StringSegment Value { get; }
609public bool HasName(StringSegment name)
Microsoft.AspNetCore.Routing.Tests (17)
PathTokenizerTest.cs (17)
11public static TheoryData<string, StringSegment[]> TokenizationData
15return new TheoryData<string, StringSegment[]>
17{ string.Empty, new StringSegment[] { } },
18{ "/", new StringSegment[] { } },
19{ "//", new StringSegment[] { new StringSegment("//", 1, 0) } },
22new StringSegment[]
30new StringSegment[]
37{ "/zero", new StringSegment[] { new StringSegment("/zero", 1, 4) } },
38{ "/zero/", new StringSegment[] { new StringSegment("/zero/", 1, 4) } },
41new StringSegment[]
49new StringSegment[]
57new StringSegment[]
66new StringSegment[]
79public void PathTokenizer_Count(string path, StringSegment[] expectedSegments)
93public void PathTokenizer_Indexer(string path, StringSegment[] expectedSegments)
107public void PathTokenizer_Enumerator(string path, StringSegment[] expectedSegments)
113Assert.Equal<StringSegment>(expectedSegments, tokenizer);
Microsoft.Extensions.FileProviders.Embedded (9)
Microsoft.Extensions.FileProviders.Physical (1)
Microsoft.Extensions.Primitives (147)
StringSegment.cs (105)
15public readonly struct StringSegment : IEquatable<StringSegment>, IEquatable<string?>
18/// A <see cref="StringSegment"/> for <see cref="string.Empty"/>.
20public static readonly StringSegment Empty = string.Empty;
23/// Initializes an instance of the <see cref="StringSegment"/> struct.
26/// The original <see cref="string"/>. The <see cref="StringSegment"/> includes the whole <see cref="string"/>.
36/// Initializes an instance of the <see cref="StringSegment"/> struct.
65/// Gets the <see cref="string"/> buffer for this <see cref="StringSegment"/>.
70/// Gets the offset within the buffer for this <see cref="StringSegment"/>.
75/// Gets the length of this <see cref="StringSegment"/>.
85/// Gets whether this <see cref="StringSegment"/> contains a valid value.
92/// Gets the <see cref="char"/> at a specified position in the current <see cref="StringSegment"/>.
94/// <param name="index">The offset into the <see cref="StringSegment"/></param>
114/// Gets a <see cref="ReadOnlySpan{T}"/> from the current <see cref="StringSegment"/>.
116/// <returns>The <see cref="ReadOnlySpan{T}"/> from this <see cref="StringSegment"/>.</returns>
120/// Gets a <see cref="ReadOnlySpan{T}"/> from the current <see cref="StringSegment"/> that starts
123/// <param name="start">The zero-based starting character position in this <see cref="StringSegment"/>.</param>
125/// this <see cref="StringSegment"/>.</returns>
140/// Gets a <see cref="ReadOnlySpan{T}"/> from the current <see cref="StringSegment"/> that starts
143/// <param name="start">The zero-based starting character position in this <see cref="StringSegment"/>.</param>
146/// <paramref name="start"/> in this <see cref="StringSegment"/>.</returns>
162/// Gets a <see cref="ReadOnlyMemory{T}"/> from the current <see cref="StringSegment"/>.
164/// <returns>The <see cref="ReadOnlyMemory{T}"/> from this <see cref="StringSegment"/>.</returns>
168/// Compares substrings of two specified <see cref="StringSegment"/> objects using the specified rules,
171/// <param name="a">The first <see cref="StringSegment"/> to compare.</param>
172/// <param name="b">The second <see cref="StringSegment"/> to compare.</param>
179public static int Compare(StringSegment a, StringSegment b, StringComparison comparisonType)
199return obj is StringSegment segment && Equals(segment);
207public bool Equals(StringSegment other) => Equals(other, StringComparison.Ordinal);
215public bool Equals(StringSegment other, StringComparison comparisonType)
231/// Determines whether two specified <see cref="StringSegment"/> objects have the same value. A parameter specifies the culture, case, and
234/// <param name="a">The first <see cref="StringSegment"/> to compare.</param>
235/// <param name="b">The second <see cref="StringSegment"/> to compare.</param>
238public static bool Equals(StringSegment a, StringSegment b, StringComparison comparisonType) => a.Equals(b, comparisonType);
241/// Checks if the specified <see cref="string"/> is equal to the current <see cref="StringSegment"/>.
243/// <param name="text">The <see cref="string"/> to compare with the current <see cref="StringSegment"/>.</param>
244/// <returns><see langword="true" /> if the specified <see cref="string"/> is equal to the current <see cref="StringSegment"/>; otherwise, <see langword="false" />.</returns>
248/// Checks if the specified <see cref="string"/> is equal to the current <see cref="StringSegment"/>.
250/// <param name="text">The <see cref="string"/> to compare with the current <see cref="StringSegment"/>.</param>
252/// <returns><see langword="true" /> if the specified <see cref="string"/> is equal to the current <see cref="StringSegment"/>; otherwise, <see langword="false" />.</returns>
287/// Checks if two specified <see cref="StringSegment"/> have the same value.
289/// <param name="left">The first <see cref="StringSegment"/> to compare, or <see langword="null" />.</param>
290/// <param name="right">The second <see cref="StringSegment"/> to compare, or <see langword="null" />.</param>
292public static bool operator ==(StringSegment left, StringSegment right) => left.Equals(right);
295/// Checks if two specified <see cref="StringSegment"/> have different values.
297/// <param name="left">The first <see cref="StringSegment"/> to compare, or <see langword="null" />.</param>
298/// <param name="right">The second <see cref="StringSegment"/> to compare, or <see langword="null" />.</param>
300public static bool operator !=(StringSegment left, StringSegment right) => !left.Equals(right);
304/// Creates a new <see cref="StringSegment"/> from the given <see cref="string"/>.
306/// <param name="value">The <see cref="string"/> to convert to a <see cref="StringSegment"/>.</param>
307public static implicit operator StringSegment(string? value) => new StringSegment(value);
310/// Creates a see <see cref="ReadOnlySpan{T}"/> from the given <see cref="StringSegment"/>.
312/// <param name="segment">The <see cref="StringSegment"/> to convert to a <see cref="ReadOnlySpan{T}"/>.</param>
313public static implicit operator ReadOnlySpan<char>(StringSegment segment) => segment.AsSpan();
316/// Creates a see <see cref="ReadOnlyMemory{T}"/> from the given <see cref="StringSegment"/>.
318/// <param name="segment">The <see cref="StringSegment"/> to convert to a <see cref="ReadOnlyMemory{T}"/>.</param>
319public static implicit operator ReadOnlyMemory<char>(StringSegment segment) => segment.AsMemory();
322/// Checks if the beginning of this <see cref="StringSegment"/> matches the specified <see cref="string"/> when compared using the specified <paramref name="comparisonType"/>.
326/// <returns><see langword="true" /> if <paramref name="text"/> matches the beginning of this <see cref="StringSegment"/>; otherwise, <see langword="false" />.</returns>
348/// Checks if the end of this <see cref="StringSegment"/> matches the specified <see cref="string"/> when compared using the specified <paramref name="comparisonType"/>.
352/// <returns><see langword="true" /> if <paramref name="text"/> matches the end of this <see cref="StringSegment"/>; otherwise, <see langword="false" />.</returns>
374/// Retrieves a substring from this <see cref="StringSegment"/>.
377/// <param name="offset">The zero-based starting character position of a substring in this <see cref="StringSegment"/>.</param>
379/// <paramref name="offset"/> in this <see cref="StringSegment"/>.</returns>
386/// Retrieves a substring from this <see cref="StringSegment"/>.
389/// <param name="offset">The zero-based starting character position of a substring in this <see cref="StringSegment"/>.</param>
392/// <paramref name="offset"/> in this <see cref="StringSegment"/>.</returns>
409/// Retrieves a <see cref="StringSegment"/> that represents a substring from this <see cref="StringSegment"/>.
410/// The <see cref="StringSegment"/> starts at the position specified by <paramref name="offset"/>.
412/// <param name="offset">The zero-based starting character position of a substring in this <see cref="StringSegment"/>.</param>
413/// <returns>A <see cref="StringSegment"/> that begins at <paramref name="offset"/> in this <see cref="StringSegment"/>
418public StringSegment Subsegment(int offset) => Subsegment(offset, Length - offset);
421/// Retrieves a <see cref="StringSegment"/> that represents a substring from this <see cref="StringSegment"/>.
422/// The <see cref="StringSegment"/> starts at the position specified by <paramref name="offset"/> and has the specified <paramref name="length"/>.
424/// <param name="offset">The zero-based starting character position of a substring in this <see cref="StringSegment"/>.</param>
426/// <returns>A <see cref="StringSegment"/> that is equivalent to the substring of <paramref name="length"/> that begins at <paramref name="offset"/> in this <see cref="StringSegment"/>.</returns>
431public StringSegment Subsegment(int offset, int length)
442/// Gets the zero-based index of the first occurrence of the character <paramref name="c"/> in this <see cref="StringSegment"/>.
448/// <returns>The zero-based index position of <paramref name="c"/> from the beginning of the <see cref="StringSegment"/> if that character is found, or -1 if it is not.</returns>
481/// Gets the zero-based index of the first occurrence of the character <paramref name="c"/> in this <see cref="StringSegment"/>.
486/// <returns>The zero-based index position of <paramref name="c"/> from the beginning of the <see cref="StringSegment"/> if that character is found, or -1 if it is not.</returns>
493/// Gets the zero-based index of the first occurrence of the character <paramref name="c"/> in this <see cref="StringSegment"/>.
496/// <returns>The zero-based index position of <paramref name="c"/> from the beginning of the <see cref="StringSegment"/> if that character is found, or -1 if it is not.</returns>
584/// <returns>The trimmed <see cref="StringSegment"/>.</returns>
585public StringSegment Trim() => TrimStart().TrimEnd();
590/// <returns>The trimmed <see cref="StringSegment"/>.</returns>
591public StringSegment TrimStart()
610/// <returns>The trimmed <see cref="StringSegment"/>.</returns>
611public StringSegment TrimEnd()
628/// Splits a string into <see cref="StringSegment"/>s that are based on the characters in an array.
632/// <returns>An <see cref="StringTokenizer"/> whose elements contain the <see cref="StringSegment"/>s from this instance
640/// Indicates whether the specified <see cref="StringSegment"/> is null or an Empty string.
642/// <param name="value">The <see cref="StringSegment"/> to test.</param>
644public static bool IsNullOrEmpty(StringSegment value)
657/// Returns the <see cref="string"/> represented by this <see cref="StringSegment"/> or <see cref="string.Empty" /> if the <see cref="StringSegment"/> does not contain a value.
659/// <returns>The <see cref="string"/> represented by this <see cref="StringSegment"/> or <see cref="string.Empty" /> if the <see cref="StringSegment"/> does not contain a value.</returns>
Microsoft.Net.Http.Headers (333)
Microsoft.Net.Http.Headers.Tests (20)