Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile Exe
#Dim All
%Unicode = 1
#Include "Win32API.inc"
%IDC_Button = 500
Global hDlg As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "PowerBASIC",300,300,200,200, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, %IDC_Button,"Push", 50,10,100,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
If Cb.Msg = %WM_Command And Cb.Ctl = %IDC_Button Then
Dim A(5) As String, B(3) As String
Array Assign A() = "5","2","3","7","1"
Array Assign B() = "1","7","3"
? ShowDifferences( A(), B())
End If
End Function
Function ShowDifferences (R() As String, S() As String) As String
'result is what in A() is not in B()
Local i,iResult As Long, temp$
Array Sort R() : Array Sort S()
For i = LBound(R) To UBound(R)
Array Scan S(), Collate UCase, = R(i), To iResult 'not case-sensitive
'If iResult=0 Then temp$ = temp$ + $CrLf + R(i)
If iResult = 0 Then temp$ = Chr$(temp$,$crlf,$R(i))
Next i
Function = temp$
End Function
'gbs_01218
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm