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(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(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(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(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