Secciones de la página

Funciones de texto txt. tol que retornan Real

Funciones

Real Txt2Month()

Real TxtBeginStrict()

Real TxtCountLeftChars()

Real TxtEndStrict()

Tol

Artículos del sitio

Presentación de Tol

Todos los programas

Simuladores visuales

Sitios que me gustan

Por categorías

Algoritmia

Búsqueda y ordenación

Computación fisiológica

Editorial y edición

Gráficos de datos

Herramientas y utilidades

Hipertexto

Informática forense

Lectura óptica de datos

Metaprogramación

No determinista

Ofimática

Recursión e iteración

Reglas y restricciones

Series y estadística









Funciones de texto txt.tol que retornan Real

Funciones para el manejo de textos, gramática Text, y que retornan un número, Real.

Las funciones de esta página están ordenadas de forma alfabética por las diferentes gramáticas del lenguaje Tol ( Text, Set, Serie, Anything, Code, Date, Real,...) y, dentro de cada gramática, por el nombre de la función. Pueden encontrarse 2 o más funciones con idéntico nombre, pero con distintas maneras de programarse o con diferentes comentarios en diferentes idiomas, estas funciones aparecerán unas a continuación de las otras.

Real Txt2Month() de Ink.Watercolor

//////////////////////////////////////////////////////////////////////////////
Real Txt2Month(Text txt) // Text 3 or more letter
//////////////////////////////////////////////////////////////////////////////
{
  Set engSet = SetTxtBeginWith(SetEnglishMonth, txt, FALSE);
  If(GT(Card(engSet), 0), engSet[1],
  {
    Set spaSet = SetTxtBeginWith(SetSpanishMonth, txt, FALSE);
    If(GT(Card(spaSet), 0), spaSet[1], 
    {
      Set porSet = SetTxtBeginWith(SetPortugueseMonth, txt, FALSE);
      If(GT(Card(porSet), 0), porSet[1], 
      {
        Set freSet = SetTxtBeginWith(SetFrenchMonth, txt, FALSE);
        If(GT(Card(freSet), 0), freSet[1], 0)
      })
    })
  })
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns a month number from the english, spanish, portuguese or french month
names (using this order).
If several months names match then returns the first one.
If none month match then returns 0.",
Txt2Month);
//////////////////////////////////////////////////////////////////////////////

Real TxtBeginStrict() de Dct.Writer

//////////////////////////////////////////////////////////////////////////////
Real TxtBeginStrict(Text txtInp, // Texto de entrada
                    Text txtIni) // Texto inicial
//////////////////////////////////////////////////////////////////////////////
{ If(txtIni=="", FALSE, TextBeginWith(txtInp, txtIni)) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Version estricta de TextBeginWith(), da falso siempre que txtIni sea nulo.",
TxtBeginStrict);
//////////////////////////////////////////////////////////////////////////////

Real TxtCountLeftChars() de Sfk.Wrap

//////////////////////////////////////////////////////////////////////////////
Real TxtCountLeftChars(Text txtInp, // Texto de entrada
                       Text oneChr) // Caracteres iniciales a contar
//////////////////////////////////////////////////////////////////////////////
{
  Real numChr = 1;                  // Contador de elementos
  Real txtLen = TextLength(txtInp); // Numero de caracteres
  
  Real While(And(LE(numChr, txtLen), Sub(txtInp, numChr, numChr) == oneChr),
  {
    Real (numChr:= Copy(numChr) + 1);

    TRUE
  });
  If(Sub(txtInp, numChr, numChr) != oneChr, numChr-1, numChr)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna el numero de caracteres iniciales de txtInp que son iguales al
caracter de entrada oneChr.",
TxtCountLeftChars);
//////////////////////////////////////////////////////////////////////////////

Real TxtEndStrict() de Dct.Writer

//////////////////////////////////////////////////////////////////////////////
Real TxtEndStrict(Text txtInp, // Texto de entrada
                  Text txtEnd) // Texto final
//////////////////////////////////////////////////////////////////////////////
{ If(txtEnd=="", FALSE, TextEndAt(txtInp, txtEnd)) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Version estricta de TextEndAt(), da falso siempre que txtEnd sea nulo.",
TxtEndStrict);
//////////////////////////////////////////////////////////////////////////////

2015 asolver.com | Aviso legal | XHTML | Δ Θ Ξ | Creative Commons | Mapa y funciones del sitio

Tol