English
Source / code snippets

Arrays find values Zweidimensionalen

 

Christian
Schneider
with safety not the eleganteste lane, but Perhaps can Yes someone something so begin:

The sought worth can as often as you like in the aray vorkommen. Return over String-aray.

In folgendem example go any Vorkommen the Wertes 8 sought.
CompileMarkSeparation
CLS
Declare Test&[1000,1000]
Declare Ergvar$[]
Test&[1,55]=8
Test&[102,354]=8
Test&[999,0]=8
Ergvar$[] = Indexof_2(Test&[],8) Syntax: Indexof_2(Array,gesuchter Wert) | Rückgabe in dyn. String-Array | Kein Fund = -1
Print Sizeof(Ergvar$[]);" Übereinstimmungen gefunden:
-------------------------------"

WhileLoop Sizeof(Ergvar$[])

    Print &loop;": ";Ergvar$[&loop-1]

Endwhile

Whilenot %scankey=27

Endwhile

Proc Indexof_2

    Declare Indexof_2_Typ1$,Indexof_2_Par&[1]
    Declare Indexof_2_Temp&
    Declare Indexof_2_Return$[],Indexof_2_Durchlauf&
    Declare Indexof_2_Decimals&,Indexof_2_Pos&,Indexof_2_stop&
    Indexof_2_Typ1$=@PType$(1)
    Indexof_2_Par&[0] = val(substr$(@Mid$(Indexof_2_Typ1$,3,len(Indexof_2_Typ1$)-3),1,","))
    Indexof_2_Par&[1] = val(substr$(@Mid$(Indexof_2_Typ1$,3,len(Indexof_2_Typ1$)-3),2,","))
    Indexof_2_Decimals&=@Get("Decimals")

    IF @Left$(Indexof_2_Typ1$,1)="&"

        Parameters Indexof_2_Array&[]

        Whilenot Indexof_2_stop&=1

            Indexof_2_Temp& = IndexOf(Indexof_2_Array&[],@&(2),Indexof_2_Pos&)
            @Set("Decimals",0)
            Indexof_2_Pos&=Indexof_2_Temp&+1

            IF Indexof_2_Temp&<0

                Indexof_2_stop&=1

                IF Sizeof(Indexof_2_Return$[])<1

                    Indexof_2_Return$[Indexof_2_Durchlauf&] = -1

                EndIF

            Else

                Indexof_2_Return$[Indexof_2_Durchlauf&] = Indexof_2_Temp& - ((Indexof_2_Temp&  (Indexof_2_Par&[0]+1))*(Indexof_2_Par&[0]+1));",";(Indexof_2_Temp&  (Indexof_2_Par&[0]+1))

            EndIF

            Inc Indexof_2_Durchlauf&
            @Set("Decimals",Indexof_2_Decimals&)

        Endwhile

    ElseIF @Left$(Indexof_2_Typ1$,1)="!"

        Parameters Indexof_2_Array![]

        Whilenot Indexof_2_stop&=1

            Indexof_2_Temp& = IndexOf(Indexof_2_Array![],@!(2),Indexof_2_Pos&)
            @Set("Decimals",0)
            Indexof_2_Pos&=Indexof_2_Temp&+1

            IF Indexof_2_Temp&<0

                Indexof_2_stop&=1

                IF Sizeof(Indexof_2_Return$[])<1

                    Indexof_2_Return$[Indexof_2_Durchlauf&] = -1

                EndIF

            Else

                Indexof_2_Return$[Indexof_2_Durchlauf&] = Indexof_2_Temp& - ((Indexof_2_Temp&  (Indexof_2_Par&[0]+1))*(Indexof_2_Par&[0]+1));",";(Indexof_2_Temp&  (Indexof_2_Par&[0]+1))

            EndIF

            Inc Indexof_2_Durchlauf&
            @Set("Decimals",Indexof_2_Decimals&)

        Endwhile

    ElseIF @Left$(Indexof_2_Typ1$,1)="$"

        Parameters Indexof_2_Array$[]

        Whilenot Indexof_2_stop&=1

            Indexof_2_Temp& = IndexOf(Indexof_2_Array$[],@$(2),Indexof_2_Pos&)
            @Set("Decimals",0)
            Indexof_2_Pos&=Indexof_2_Temp&+1

            IF Indexof_2_Temp&<0

                Indexof_2_stop&=1

                IF Sizeof(Indexof_2_Return$[])<1

                    Indexof_2_Return$[Indexof_2_Durchlauf&] = -1

                EndIF

            Else

                Indexof_2_Return$[Indexof_2_Durchlauf&] = Indexof_2_Temp& - ((Indexof_2_Temp&  (Indexof_2_Par&[0]+1))*(Indexof_2_Par&[0]+1));",";(Indexof_2_Temp&  (Indexof_2_Par&[0]+1))

            EndIF

            Inc Indexof_2_Durchlauf&
            @Set("Decimals",Indexof_2_Decimals&)

        Endwhile

    EndIF

    Return Indexof_2_Re
span class=s2>[] Endproc
 
XProfan 11| Vista(64) SP2
11/07/09  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

4.792 Views

Untitledvor 0 min.
H.Brill09/24/22
RudiB.03/08/22
Jörg Sellmeyer06/02/18
Georg Teles02/13/16
More...

Themeninformationen

this Topic has 1 subscriber:

Christian Schneider (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie