• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# StringBuffer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中StringBuffer的典型用法代码示例。如果您正苦于以下问题:C# StringBuffer类的具体用法?C# StringBuffer怎么用?C# StringBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



StringBuffer类属于命名空间,在下文中一共展示了StringBuffer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 );
 }
开发者ID:Chameleonherman,项目名称:ClassicalSharp,代码行数:9,代码来源:MenuInputWidget.cs


示例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);
 }
开发者ID:ralf-lindberg-3bits,项目名称:blackbox,代码行数:7,代码来源:StringBufferTests.cs


示例3: toString

 public override string toString()
 {
   StringBuffer stringBuffer = new StringBuffer("AxisEntity: ");
   stringBuffer.append("tooltip = ");
   stringBuffer.append(this.getToolTipText());
   return stringBuffer.toString();
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:7,代码来源:AxisEntity.cs


示例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;
    }
开发者ID:jacklp,项目名称:goldsmiths_gamejam_jan_2016,代码行数:27,代码来源:InputController.cs


示例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;
        }
开发者ID:willrawls,项目名称:arp,代码行数:32,代码来源:ReferenceParser.cs


示例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();
        }
开发者ID:Coopermine,项目名称:P25M_PRINTER,代码行数:38,代码来源:ByteConverter.cs


示例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);
 }
开发者ID:ralf-lindberg-3bits,项目名称:blackbox,代码行数:7,代码来源:StringBufferTests.cs


示例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);
 }
开发者ID:ralf-lindberg-3bits,项目名称:blackbox,代码行数:8,代码来源:StringBufferTests.cs


示例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();
        }
开发者ID:MicahelWang,项目名称:XamarinSamples,代码行数:8,代码来源:MD5Util.cs


示例10: GetBuffer

 private StringBuffer GetBuffer()
 {
   if (this._buffer == null)
     this._buffer = new StringBuffer(4096);
   else
     this._buffer.Position = 0;
   return this._buffer;
 }
开发者ID:tanis2000,项目名称:FEZ,代码行数:8,代码来源:JsonTextReader.cs


示例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));
    }
开发者ID:shmao,项目名称:corefx,代码行数:8,代码来源:PathInternal.Windows.Tests.cs


示例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;
    }
开发者ID:284247028,项目名称:MvvmCross,代码行数:13,代码来源:JsonTextReader.cs


示例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();
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:9,代码来源:CategoryLabelEntity.cs


示例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();
	}
开发者ID:PaulMineau,项目名称:AIMA.Net,代码行数:10,代码来源:MapAgentTest.cs


示例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);
     }
 }
开发者ID:AtsushiKan,项目名称:coreclr,代码行数:13,代码来源:StringBuffer.cs


示例16: GetModelCodeFormDb

        public static string GetModelCodeFormDb(string tableName)
        {
            using (var session = new SessionFactory().OpenSession())
            {
                var model = session.FindBySql<DbTable>("show full fields from " + tableName);
                if (model == null || model.Count == 0)
                {
                    // table不存在
                    return null;
                }
                var tb = new StringBuffer();
                foreach (var col in model)
                {
                    tb += Environment.NewLine;
                    if (col.Null.Equals("NO"))
                    {
                        tb += string.Format("[Required]{0}", Environment.NewLine);
                    }
                    if (col.Key.Equals("PRI"))
                    {
                        tb += "[PrimaryKey]" + Environment.NewLine;
                    }
                    if (!string.IsNullOrEmpty(col.Comment))
                    {
                        tb += string.Format("[DisplayName(\"{0}\")]{1}", col.Comment, Environment.NewLine);
                    }
                    var type = col.Type;
                    if (type.Contains("("))
                    {
                        var temp = type.Split('(');
                        type = temp[0];
                        var length = temp[1].Substring(0, temp[1].LastIndexOf(")", StringComparison.Ordinal));
                        if (type.Equals("text") || type.Equals("varchar"))
                            tb += string.Format("[StringLength({0})]{1}", length, Environment.NewLine);
                    }
                    var name = col.Field.Pascalize();
                    var mappingDic = new Dictionary<string, string>
                                         {
                                             {"tinyint", "bool"},
                                             {"int", "int"},
                                             {"bigint", "long"},
                                             {"varchar", "string"},
                                             {"text", "string"},
                                             {"datetime", "DateTime"},
                                             {"decimal", "Decimal"}
                                         };
                    //未匹配的默认为string
                    var typeStr = mappingDic[type] ?? "string";
                    tb += string.Format("public {0}{1}{2}{3}{4}", typeStr, (col.Null.Equals("YES") && !typeStr.Equals("string") ? "? " : " "), name, "{get; set;}", Environment.NewLine);
                }
                return tb.ToString();

            }
        }
开发者ID:dalinhuang,项目名称:info_platform,代码行数:54,代码来源:DevelopmentActivity.cs


示例17: format

 public virtual StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos)
 {
   string str = String.instancehelper_toUpperCase(Long.toHexString(number));
   int num1 = this.m_numDigits - String.instancehelper_length(str);
   int num2 = 0 >= num1 ? 0 : num1;
   StringBuffer stringBuffer = new StringBuffer("0x");
   for (int index = 0; index < num2; ++index)
     stringBuffer.append(0);
   stringBuffer.append(str);
   return stringBuffer;
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:11,代码来源:HexNumberFormat.cs


示例18: insertString

 public virtual void insertString(int offs, string str, AttributeSet a)
 {
   if (str == null)
     return;
   if (this.maxlen < 0)
     base.insertString(offs, str, a);
   char[] chArray = String.instancehelper_toCharArray(str);
   StringBuffer stringBuffer = new StringBuffer();
   stringBuffer.append(chArray, 0, Math.min(this.maxlen, chArray.Length));
   base.insertString(offs, stringBuffer.toString(), a);
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:11,代码来源:LengthLimitingDocument.cs


示例19: SetAttributeValiue

        public static void SetAttributeValiue(IXmlAttribute attribute, string newValue)
        {
            if (newValue == null)
                throw new ArgumentNullException("newValue");

            Assert.CheckNotNull(attribute.Value, "attribute.Value");
            IXmlAttributeValueNode oldValueNode = attribute.Value.ToTreeNode();
            StringBuffer buffer = new StringBuffer("\"" + newValue + "\"");
            XmlTokenTypes types = XmlTokenTypeFactory.GetTokenTypes(attribute.Language);
            XmlValueToken newValueNode = new XmlValueToken(types.STRING, buffer, 0, buffer.Length);
            LowLevelModificationUtil.ReplaceChildRange(oldValueNode, oldValueNode, new ITreeNode[] { newValueNode });
        }
开发者ID:willrawls,项目名称:arp,代码行数:12,代码来源:XMLPSIUtils.cs


示例20: AddBlankLineAfter

    /// <summary>Adds the blank line after.</summary>
    /// <param name="statement">The statement.</param>
    public void AddBlankLineAfter([NotNull] IStatement statement)
    {
      if (statement == null)
      {
        throw new ArgumentNullException("statement");
      }

      var newLineText = new StringBuffer("\r\n");
      ITreeNode newLine = TreeElementFactory.CreateLeafElement(CSharpTokenType.NEW_LINE, newLineText, 0, newLineText.Length);

      ModificationUtil.AddChildAfter(statement, newLine);
    }
开发者ID:JakobChristensen,项目名称:Resharper.CodeAnnotations,代码行数:14,代码来源:CodeAnnotationFix.cs



注:本文中的StringBuffer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# StringBuilder类代码示例发布时间:2022-05-24
下一篇:
C# StringAlignment类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap