Funciones de basicas de ficheros.
Funciones
Text FilBetween2Tag(Text filPth, Text tagIni, Text tagEnd)Text FilDelExtLow(Text namFil)Real FilTextFind(Text filPth, Text fndTxt)//////////////////////////////////////////////////////////////////////////////
Text FilBetween2Tag(Text filPth, // Ruta de un fichero
Text tagIni, // Tag inicial
Text tagEnd) // Tag final
//////////////////////////////////////////////////////////////////////////////
{
If(!FileExist(filPth), "", // Nada si el fichero no existe
If(And(tagIni=="", tagEnd==""),
ReadFile(filPth), // Todo el fichero
TxtBetween2Tag(ReadFile(filPth), tagIni, tagEnd, FALSE))) // No compacta
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna el codigo resultado de reconvertir &, < y >.",
FilBetween2Tag);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text FilDelExtLow(Text namFil)
//////////////////////////////////////////////////////////////////////////////
{ Replace(ToLower(namFil),".","_") };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un nombre de fichero cambiando el . de la extension y cualquier otro
punto por un subrayador y pasandolo a minusculas.",
FilDelExtLow);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Real FilTextFind(Text filPth, // Ruta de un fichero
Text fndTxt) // Texto a buscar
//////////////////////////////////////////////////////////////////////////////
{ If(!FileExist(filPth), 0, TextFind(ReadFile(filPth), fndTxt)) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna la posicion de un texto dentro de un fichero
Es similar a TextFind() pero para ficheros.",
FilDelExtLow);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// FILE : fil.tol
// AUTHOR : http://www.asolver.com
// PURPOSE : Funciones de basicas de ficheros.
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text FilBetween2Tag(Text filPth, // Ruta de un fichero
Text tagIni, // Tag inicial
Text tagEnd) // Tag final
//////////////////////////////////////////////////////////////////////////////
{
If(!FileExist(filPth), "", // Nada si el fichero no existe
If(And(tagIni=="", tagEnd==""),
ReadFile(filPth), // Todo el fichero
TxtBetween2Tag(ReadFile(filPth), tagIni, tagEnd, FALSE))) // No compacta
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna el codigo resultado de reconvertir &, < y >.",
FilBetween2Tag);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text FilDelExtLow(Text namFil)
//////////////////////////////////////////////////////////////////////////////
{ Replace(ToLower(namFil),".","_") };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un nombre de fichero cambiando el . de la extension y cualquier otro
punto por un subrayador y pasandolo a minusculas.",
FilDelExtLow);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Real FilTextFind(Text filPth, // Ruta de un fichero
Text fndTxt) // Texto a buscar
//////////////////////////////////////////////////////////////////////////////
{ If(!FileExist(filPth), 0, TextFind(ReadFile(filPth), fndTxt)) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna la posicion de un texto dentro de un fichero
Es similar a TextFind() pero para ficheros.",
FilDelExtLow);
//////////////////////////////////////////////////////////////////////////////
Dct.Writer documenta programas Tol generado agendas para Html
2015 asolver.com | Aviso legal | XHTML | Δ Θ Ξ | Creative Commons | Mapa y funciones del sitio