Esempio n. 1
0
        public int CompareTo(text other)
        {
            int compareTo;

            if (other != null)
            {
                compareTo = tString.ToString().CompareTo(other.ToString());
            }
            else
            {
                compareTo = -1;
            }
            return(compareTo);
        }
Esempio n. 2
0
        public void QuitarPlantilla(string plantilla, string sustituto)
        {
            int fin = 0;
            //cuando encuentra el sustituto es el inicio y cuando acaba lo que queda es el resto...
            int  posicion = 0;
            int  pos      = 0;
            text stringT  = "";

            for (int i = 0, plantillaCount = plantilla.Length; i < plantillaCount && fin == 0; i++)
            {
                char caracter = plantilla[i];
                if (pos < sustituto.Length)
                {
                    if (sustituto[pos] == caracter)
                    {
                        stringT += caracter;
                        pos++;
                    }
                    else
                    {
                        pos     = 0;
                        stringT = "";
                    }
                }
                if (stringT.ToString().Equals(sustituto))
                {
                    fin = posicion;
                }
                posicion++;
            }
            if (fin != 0)
            {
                stringT = ToString().Substring(fin - sustituto.Length + 1, ToString().Length - fin - 2);
                this.tString.Clear();
                this.tString.Append(stringT);
            }
        }