public virtual void TestReverse()
        {
            var sb = new StringBuilder("foo šŒ† barš«€maƱana");

            sb.Reverse();

            Assert.AreEqual("anaƱamš«€rab šŒ† oof", sb.ToString());
        }
Example #2
0
        /// <summary>
        /// Gets the full path to this document.
        /// </summary>
        ///
        /// <returns>
        /// The path.
        /// </returns>

        protected virtual string GetPath()
        {
            DomObject curNode = this;
            StringBuilder sb = new StringBuilder();

            while (curNode != null)
            {
#if CACHE_PATH
                if (curNode._Path != null)
                {
                    return curNode._Path + sb.Reverse().ToString();
                }

#endif
                sb.Append(curNode.PathID);
                curNode = curNode._ParentNode;
            }
            return sb.Reverse().ToString();
        }
        /// <summary>
        /// Returns the key that indexes the node argument.
        /// </summary>
        /// <param name="node">
        ///          The node whose index is to be calculated. </param>
        /// <returns> The <code>String</code> that indexes the node argument. </returns>
        protected internal virtual string getKey(TSTNode node)
        {
            StringBuilder getKeyBuffer = new StringBuilder();
            getKeyBuffer.Length = 0;
            getKeyBuffer.Append("" + node.splitchar);
            TSTNode currentNode;
            TSTNode lastNode;
            currentNode = node.relatives[TSTNode.PARENT];
            lastNode = node;
            while (currentNode != null)
            {
                if (currentNode.relatives[TSTNode.EQKID] == lastNode)
                {
                    getKeyBuffer.Append("" + currentNode.splitchar);
                }
                lastNode = currentNode;
                currentNode = currentNode.relatives[TSTNode.PARENT];
            }

            getKeyBuffer.Reverse();
            return getKeyBuffer.ToString();
        }