本文整理汇总了C#中StringSegment.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# StringSegment.ToString方法的具体用法?C# StringSegment.ToString怎么用?C# StringSegment.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringSegment
的用法示例。
在下文中一共展示了StringSegment.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StringSegment_CanBeCreatedFromString
public void StringSegment_CanBeCreatedFromString()
{
var source = "Hello, world!";
var segment = new StringSegment(source, 2, 4);
TheResultingString(segment.ToString())
.ShouldBe("llo,");
}
示例2: Basic
public void Basic()
{
StringSegment text = new StringSegment("basic");
TextWikiRun run = new TextWikiRun(text);
Assert.IsTrue(run.Text == text.ToString());
}
示例3: RegisterLinkTarget
/// <summary>
/// Registers a link target with the command stream.
/// </summary>
/// <param name="target">The link target to register.</param>
/// <returns>The index of the specified link target within the command stream's internal registry.</returns>
public Int16 RegisterLinkTarget(StringSegment target) =>
(resources = resources ?? new TextLayoutCommandStreamResources()).RegisterLinkTarget(target.ToString());
示例4: RegisterLinkTargetWithCommandStream
/// <summary>
/// Registers the specified link target with the command stream and returns its resulting index.
/// </summary>
private Int16 RegisterLinkTargetWithCommandStream(TextLayoutCommandStream output, StringSegment target)
{
return output.RegisterLinkTarget(target.ToString());
}
示例5: Segmented
public void Segmented(string content, int start, int end, string expectedSegment)
{
var segment = new StringSegment(content, start, end);
Assert.Equal(end, segment.EndIndex);
Assert.False(segment.IsEmpty);
Assert.False(segment.IsNull);
Assert.Equal(expectedSegment.Length, segment.Length);
Assert.Equal(TestContent, segment.Source);
Assert.Equal(start, segment.StartIndex);
Assert.Equal(expectedSegment, segment.ToString());
}
示例6: TestToString
public void TestToString(string content, int startIndex, int endIndex, string expected)
{
var segment = new StringSegment(content, startIndex, endIndex);
Assert.Equal(expected, segment.ToString());
}
示例7: DecodeBody
static StringSegment DecodeBody(Message message)
{
StringSegment innerMessageText = message.Body.SourceText;
TransferEncoding encoding = message.GetTransferEncoding();
switch (encoding)
{
default:
throw new MimeException(MimeError.TransferEncodingNotSupported);
case TransferEncoding.SevenBit:
break; // Nothing to do
case TransferEncoding.QuotedPrintable:
string decodedText = QuotedPrintableDecoder.Decode(innerMessageText);
innerMessageText = new StringSegment(decodedText);
break;
case TransferEncoding.Base64:
byte[] bytes = Convert.FromBase64String(innerMessageText.ToString());
string textFromBytes = Encoding.ASCII.GetString(bytes);
innerMessageText = new StringSegment(textFromBytes);
break;
}
return innerMessageText;
}