Lucene.Net.Analysis.Tokenattributes.CharTermAttribute.ToString C# (CSharp) Method

ToString() public method

Returns solely the term text as specified by the CharSequence interface.

this method changed the behavior with Lucene 3.1, before it returned a String representation of the whole term with all attributes. this affects especially the Lucene.Net.Analysis.Token subclass.

public ToString ( ) : string
return string
        public override string ToString()
        {
            return new string(TermBuffer, 0, TermLength);
        }

Usage Example

示例#1
0
        public virtual void TestToString()
        {
            char[]            b = new char[] { 'a', 'l', 'o', 'h', 'a' };
            CharTermAttribute t = new CharTermAttribute();

            t.CopyBuffer(b, 0, 5);
            Assert.AreEqual("aloha", t.ToString());

            t.SetEmpty().Append("hi there");
            Assert.AreEqual("hi there", t.ToString());
        }
All Usage Examples Of Lucene.Net.Analysis.Tokenattributes.CharTermAttribute::ToString