J
J Ivan P Silvestre
Is true in bath dont exist list's or array's so I create the an
estructure with diferents method's just like a List in c#:
------------------------------------------------------------------------------
:List_add_value
set %1=%2,%3
goto:EOF
:List_Return_Value_by_index
set count=0
if %2 lss 0 (echo Index inexistent!!! & goto:EOF)
set lenght=0
call :List_Lenght %1 lenght
if %lenght% lss %2 (echo Index inexistent!!! & goto:EOF)
for %%k in (%~1) do (if %2 equ %count% (set %3=%%k) else (set /a count
+=1) )
goto:EOF
:List_Lenght
set count=0
for %%k in (%1) do (set /a count+=1)
set %2=%count%
goto:EOF
:List_Contain
set %3=false
for %%k in (%1) do (if %%k equ %2 ( set %3=true))
goto:EOF
:List_Show
for %%k in (%1) do (echo%%k)
goto:EOF
:List_Iterator_current
set %1End=false
IF not defined count (set count=0) else (set /a count+=1)
call :List_Lenght %1 count2
IF %count2% lss %count%(set %1End=true&Goto:EOF)
call :List_Return_Value_by_index %1 %count% %3
goto:EOF
:List_set_var_by_index
set listaux=
call :List_Lenght %2 ln
set /a indexbound=%3-1
FOR /L %%a IN (0,1,%indexbound%) DO (
call :List_Return_Value_by_index %2 %%a val
call :List_add_value listaux %listaux% %val%
)
call :List_add_value listaux %listaux% %4
if %3 equ %ln% (set %1=%listaux%&goto:EOF)
set /a indexbound=%3+1
FOR /L %%a IN (%indexbound%,1,%ln%) DO (
call :List_Return_Value_by_index %2 %%a val
call :List_add_value listaux %listaux% %val%
)
set %1=%listaux%
goto:EOF
------------------------------------------------------------------------------------------------------
A small consept of list or array I've created for bath:
this is literally consept base in a variable which we fill separated
values with "," with the following methods and get position, the list
of properties and order of values. In addition to that we can change
values in positions especific efficiently. So you can create their
lists in time of execution which can contain any kind of values very
much in the style of other languages. Of course you'll also see the
lists from a standpoint of structuring data.
- List_add_value:
syntax:
call: List_add_value List ContentOfTheList ValueForAdd
to add values to the list is not necessary to create the first
variable
you can simply call
call: List_add_value var%% var blue
- List_Return_Value_by_index:
syntax:
call: List_Return_Value_by_index ContentOfTheList index
VarToRecieveValue
The minimum value of the index is always zero
call: List_Return_Value_by_index% 2% var result
- List_Lenght:
takes us back the amount of securities in the chain always counting
from zero
syntax:
Call: List_Lenght ContentOfTheList VarToRecieveValue
- List_Contain:
It returns in a variable true if the list contains some value
otherwise false
syntax:
call: List_Contain ContentOfTheList valorhacontener
VarToRecieveValuetrueorfalse
- List_Show:
Prints the list on the console
syntax:
Call: List_Show ContentOfTheList
- List_Iterator_current:
this method every time you invoked and returns the following value in
the list
syntax:
call: List_Iterator_current List ContentOfTheList ReturnValue
You also creates a variable nombredelalista + End containing true in
the case has finished iteration otherwise false. For thus facilitating
its use in cycles.
- List_set_var_by_index:
SETE a value of the list in a specific index
syntax:
call: List_set_var_by_index list ContentOfTheList index newvalue
estructure with diferents method's just like a List in c#:
------------------------------------------------------------------------------
:List_add_value
set %1=%2,%3
goto:EOF
:List_Return_Value_by_index
set count=0
if %2 lss 0 (echo Index inexistent!!! & goto:EOF)
set lenght=0
call :List_Lenght %1 lenght
if %lenght% lss %2 (echo Index inexistent!!! & goto:EOF)
for %%k in (%~1) do (if %2 equ %count% (set %3=%%k) else (set /a count
+=1) )
goto:EOF
:List_Lenght
set count=0
for %%k in (%1) do (set /a count+=1)
set %2=%count%
goto:EOF
:List_Contain
set %3=false
for %%k in (%1) do (if %%k equ %2 ( set %3=true))
goto:EOF
:List_Show
for %%k in (%1) do (echo%%k)
goto:EOF
:List_Iterator_current
set %1End=false
IF not defined count (set count=0) else (set /a count+=1)
call :List_Lenght %1 count2
IF %count2% lss %count%(set %1End=true&Goto:EOF)
call :List_Return_Value_by_index %1 %count% %3
goto:EOF
:List_set_var_by_index
set listaux=
call :List_Lenght %2 ln
set /a indexbound=%3-1
FOR /L %%a IN (0,1,%indexbound%) DO (
call :List_Return_Value_by_index %2 %%a val
call :List_add_value listaux %listaux% %val%
)
call :List_add_value listaux %listaux% %4
if %3 equ %ln% (set %1=%listaux%&goto:EOF)
set /a indexbound=%3+1
FOR /L %%a IN (%indexbound%,1,%ln%) DO (
call :List_Return_Value_by_index %2 %%a val
call :List_add_value listaux %listaux% %val%
)
set %1=%listaux%
goto:EOF
------------------------------------------------------------------------------------------------------
A small consept of list or array I've created for bath:
this is literally consept base in a variable which we fill separated
values with "," with the following methods and get position, the list
of properties and order of values. In addition to that we can change
values in positions especific efficiently. So you can create their
lists in time of execution which can contain any kind of values very
much in the style of other languages. Of course you'll also see the
lists from a standpoint of structuring data.
- List_add_value:
syntax:
call: List_add_value List ContentOfTheList ValueForAdd
to add values to the list is not necessary to create the first
variable
you can simply call
call: List_add_value var%% var blue
- List_Return_Value_by_index:
syntax:
call: List_Return_Value_by_index ContentOfTheList index
VarToRecieveValue
The minimum value of the index is always zero
call: List_Return_Value_by_index% 2% var result
- List_Lenght:
takes us back the amount of securities in the chain always counting
from zero
syntax:
Call: List_Lenght ContentOfTheList VarToRecieveValue
- List_Contain:
It returns in a variable true if the list contains some value
otherwise false
syntax:
call: List_Contain ContentOfTheList valorhacontener
VarToRecieveValuetrueorfalse
- List_Show:
Prints the list on the console
syntax:
Call: List_Show ContentOfTheList
- List_Iterator_current:
this method every time you invoked and returns the following value in
the list
syntax:
call: List_Iterator_current List ContentOfTheList ReturnValue
You also creates a variable nombredelalista + End containing true in
the case has finished iteration otherwise false. For thus facilitating
its use in cycles.
- List_set_var_by_index:
SETE a value of the list in a specific index
syntax:
call: List_set_var_by_index list ContentOfTheList index newvalue