Filter 9.0 Final

Iniciado por carlitos.java, 15 Noviembre 2008, 06:01 AM

0 Miembros y 1 Visitante están viendo este tema.

carlitos.java

Finalmente, doy por finalizado el FILTER 9.0 Final que es un limpiador del contenido de las variables.

Esta versión soluciona un bug de la vérsión 8, que ocurría al tener definidas variables de un sufijo en comun e ingresar en la variable a filtrar solamente carácteres basura. Además esta versión tiene un código más compacto, y eficiente.


@ECHO OFF
:START
CLS
SET NAME=
SET /P NAME=ENTER YOUR NAME:
IF NOT DEFINED NAME (GOTO:START)
CALL:FILTER NAME
IF NOT DEFINED NAME (GOTO:START)
ECHO HELLO %NAME%
PAUSE
GOTO:START
GOTO:EOF

:FILTER
::Usage: CALL:FILTER variable_Name
::Example: CALL:FILTER INPUT
::Note: The Max Length of the Clean Output is 50 characters.
::.==============================================================================.
::|| FILTER v9.0 Final. Copyright (c) 2008 Carlos. All rights reserved. ||
::|| Thanks to sirdarckcat and avery_larry for your cooperation.                ||
::.==============================================================================.=====================================.
::|| CARLOS . DISCLAIMS ALL WARRANTIES, RESPONSIBILITIES, AND LIABILITIES ASSOCIATED WITH USE OF THIS CODE IN  ||
::|| ANY WAY, SHAPE, OR FORM REGARDLESS HOW IMPLICIT, EXPLICIT, OR OBSCURE IT IS. IF THERE IS ANYTHING QUESTIONABLE   ||
::|| WITH REGARDS TO THIS SOFTWARE BREAKING AND YOU GAIN A LOSS OF ANY NATURE,I AM NOT THE RESPONSIBLE PARTY. USE OF  ||
::|| THIS SOFTWARE CREATES ACCEPTANCE OF THESE TERMS. THE MODIFICATION OF THIS CODE REQUIRED TO ADD A FOOTNOTE TO     ||
::|| THIS TEXT WITH THE NAME OF WHO MADE THE CHANGES.                                                                 ||
::|| USE OF THIS CODE MUST RETAIN ALL COPYRIGHT NOTICES AND LICENSES (MEANING THIS TEXT).                             ||
::.====================================================================================================================.
;;@IF NOT DEFINED %1 (GOTO:_FILTERE) || (GOTO:_FILTERE)
;;@FOR /F "TOKENS=1-27 DELIMS==%%^|^&^^^>^<#`'.:,;/\+-_~!^)^(][}{:^?^*$" %%A IN ('@SET %1') DO (@IF [%%A] EQU [%1] (
;;@CALL:_FILTER %%~B%%~C%%~D%%~E%%~F%%~G%%~H%%~I%%~J%%~K%%~L%%~M%%~N%%~O%%~P%%~Q%%~R%%~S%%~T%%~U%%~V%%~W%%~X%%~Y%%~Z))
;;@CALL:_FILTER %.IN_%
;;@IF DEFINED .IN_ (@SET %1=%.IN_:~0,50%
;;) ELSE (@SET %1=)
;;@GOTO:EOF
;:_FILTER
;;@SET .IN_=%~1%~2%~3%~4%~5%~6%~7%~8%~9_
;;@SET .IN_=%.IN_:"=%
;;@SET .IN_=%.IN_:_=%
;;@GOTO:EOF
;:_FILTERE
;;@ECHO FILTER FUNCTION RECEIVE A DEFINED VARIABLE.
;;@PAUSE
;;@GOTO:EOF