本文整理汇总了C#中StringBuffer类的典型用法代码示例。如果您正苦于以下问题:C# StringBuffer类的具体用法?C# StringBuffer怎么用?C# StringBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringBuffer类属于命名空间,在下文中一共展示了StringBuffer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MenuInputWidget
public MenuInputWidget( Game game, Font font, Font boldFont )
: base(game)
{
HorizontalAnchor = Anchor.LeftOrTop;
VerticalAnchor = Anchor.BottomOrRight;
this.font = font;
this.boldFont = boldFont;
chatInputText = new StringBuffer( 64 );
}
示例2: StringBuffer_Peek
public void StringBuffer_Peek()
{
StringBuffer buffer = new StringBuffer("Hello World");
Assert.AreEqual(0, buffer.Position);
Assert.AreEqual('H', (char)buffer.Peek());
Assert.AreEqual(0, buffer.Position);
}
示例3: toString
public override string toString()
{
StringBuffer stringBuffer = new StringBuffer("AxisEntity: ");
stringBuffer.append("tooltip = ");
stringBuffer.append(this.getToolTipText());
return stringBuffer.toString();
}
示例4: Awake
void Awake() {
inputBuffer = new StringBuffer();
currentIllnesses = new List<Illness>();
illnessesDef = new List<Illness>();
tooSlowText = GameObject.Find("TooSlow");
tooSlowText.SetActive(false);
if (PlayerPrefs.GetInt("hardmode") == 1) {
illnessesDef.Add(new Illness("Arrow", "udruldur", 2.1f));
illnessesDef.Add(new Illness("Axe", "llurdul", 1.8f));
illnessesDef.Add(new Illness("Eye", "lrlruld", 2.0f));
illnessesDef.Add(new Illness("Hair", "udldrulu", 2.1f));
illnessesDef.Add(new Illness("Green", "dudulrud", 2.3f));
illnessesDef.Add(new Illness("Knife", "rulruudru", 2.3f));
} else {
illnessesDef.Add(new Illness("Arrow", "dudu", 0.8f));
illnessesDef.Add(new Illness("Axe", "udlr", 0.8f));
illnessesDef.Add(new Illness("Eye", "lurldr", 1.3f));
illnessesDef.Add(new Illness("Hair", "uurdd", 1.3f));
illnessesDef.Add(new Illness("Green", "lldrru", 1.5f));
illnessesDef.Add(new Illness("Knife", "durulu", 1.5f));
}
gameManager = GetComponent<GameManager>();
checkSequence = false;
}
示例5: Parse
public IXmlAttributeValue Parse(IXmlAttributeValue xmlAttributeValue)
{
ReferenceNameAttributeValue attributeValue = new ReferenceNameAttributeValue();
CompositeElement result = null;
string rawValue = xmlAttributeValue.UnquotedValue;
try
{
result = ParseTypeNameOrAttributeValue(rawValue);
}
catch (SyntaxError syntaxError)
{
result = (CompositeElement)syntaxError.ParsingResult;
result = handleError(result, syntaxError);
}
attributeValue.AddChild(new XmlToken(L4NTokenNodeType.QUOTE, new StringBuffer(new string('\"', 1)), 0, 1));
attributeValue.AddChild(result);
int resultLegth = result.GetText().Length;
if(resultLegth < rawValue.Length)
{
string suffix = rawValue.Substring(resultLegth);
StringBuffer sb = new StringBuffer(suffix);
XmlToken suffixToken = new XmlToken(L4NTokenNodeType.TEXT , sb, 0, suffix.Length);
attributeValue.AddChild(suffixToken);
}
attributeValue.AddChild(new XmlToken(L4NTokenNodeType.QUOTE, new StringBuffer(new string('\"', 1)), 0, 1));
return attributeValue;
}
示例6: buf2String
/**
* convert byte array to Hex String.
*
* @param info - the propmt String
* @param buf - the byte array which will be converted
* @param offset - the start position of buf
* @param length - the converted length
* @param isOneLine16 - if true 16 bytes one line, false all bytes in one line
* @return Hex String
*/
public static string buf2String(string info, byte[] buf, int offset,
int length, bool oneLine16)
{
int i, index;
StringBuffer sBuf = new StringBuffer();
sBuf.Append(info);
for (i = 0 + offset; i < length + offset; i++)
{
if (i % 16 == 0)
{
if (oneLine16)
{
sBuf.Append(lineSeperate);
}
} else if (i % 8 == 0)
{
if (oneLine16)
{
sBuf.Append(" ");
}
}
index = buf[i] < 0 ? buf[i] + DEFAULT_TABLE_LENGTH : buf[i];
sBuf.Append(convertTable[index]);
}
return sBuf.ToString();
}
示例7: StringBuffer_Create
public void StringBuffer_Create()
{
StringBuffer buffer = new StringBuffer("Hello World");
Assert.AreEqual("Hello World", buffer.Content);
Assert.AreEqual(11, buffer.Length);
Assert.AreEqual(0, buffer.Position);
}
示例8: StringBuffer_Rewind
public void StringBuffer_Rewind()
{
StringBuffer buffer = new StringBuffer("Hello World");
Assert.IsTrue(buffer.Seek(6));
Assert.AreEqual(6, buffer.Position);
buffer.Rewind();
Assert.AreEqual(0, buffer.Position);
}
示例9: ByteArrayToHexString
private static string ByteArrayToHexString(byte[] b)
{
StringBuffer resultSb = new StringBuffer();
for (int i = 0; i < b.Length; i++)
resultSb.Append(ByteToHexString(b[i]));
return resultSb.ToString();
}
示例10: GetBuffer
private StringBuffer GetBuffer()
{
if (this._buffer == null)
this._buffer = new StringBuffer(4096);
else
this._buffer.Position = 0;
return this._buffer;
}
示例11: IsExtendedTest
public void IsExtendedTest(string path, bool expected)
{
StringBuffer sb = new StringBuffer();
sb.Append(path);
Assert.Equal(expected, PathInternal.IsExtended(sb));
Assert.Equal(expected, PathInternal.IsExtended(path));
}
示例12: JsonTextReader
/// <summary>
/// Initializes a new instance of the <see cref="JsonReader"/> class with the specified <see cref="TextReader"/>.
/// </summary>
/// <param name="reader">The <c>TextReader</c> containing the XML data to read.</param>
public JsonTextReader(TextReader reader)
{
if (reader == null)
throw new ArgumentNullException("reader");
_reader = reader;
_buffer = new StringBuffer(4096);
_currentLineNumber = 1;
}
示例13: toString
public override string toString()
{
StringBuffer stringBuffer = new StringBuffer("CategoryLabelEntity: ");
stringBuffer.append("category=");
stringBuffer.append((object) this.key);
stringBuffer.append(new StringBuffer().append(", tooltip=").append(this.getToolTipText()).toString());
stringBuffer.append(new StringBuffer().append(", url=").append(this.getURLText()).toString());
return stringBuffer.toString();
}
示例14: setUp
public void setUp() {
aMap = new ExtendableMap();
aMap.addBidirectionalLink("A", "B", 5.0);
aMap.addBidirectionalLink("A", "C", 6.0);
aMap.addBidirectionalLink("B", "C", 4.0);
aMap.addBidirectionalLink("C", "D", 7.0);
aMap.addUnidirectionalLink("B", "E", 14.0);
envChanges = new StringBuffer();
}
示例15: StringBuffer
/// <summary>
/// Instantiate the buffer with a copy of the specified StringBuffer.
/// </summary>
public StringBuffer(StringBuffer initialContents)
: base(0)
{
// We don't pass the count of bytes to the base constructor, appending will
// initialize to the correct size for the specified initial contents.
if (initialContents != null)
{
Append(initialContents);
}
}