Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
4
Task/Binary-strings/VBA/binary-strings-1.vba
Normal file
4
Task/Binary-strings/VBA/binary-strings-1.vba
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
'Set the string comparison method to Binary.
|
||||
Option Compare Binary ' That is, "AAA" is less than "aaa".
|
||||
' Set the string comparison method to Text.
|
||||
Option Compare Text ' That is, "AAA" is equal to "aaa".
|
||||
9
Task/Binary-strings/VBA/binary-strings-10.vba
Normal file
9
Task/Binary-strings/VBA/binary-strings-10.vba
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
Sub Join_Strings()
|
||||
Dim A$, B As String
|
||||
|
||||
A = "Hello"
|
||||
B = "world"
|
||||
Debug.Print A & " " & B 'return : Hello world
|
||||
'If you're sure that A and B are Strings, you can use + instead of & :
|
||||
Debug.Print A + " " + B 'return : Hello world
|
||||
End Sub
|
||||
5
Task/Binary-strings/VBA/binary-strings-2.vba
Normal file
5
Task/Binary-strings/VBA/binary-strings-2.vba
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Sub Creation_String_FirstWay()
|
||||
Dim myString As String
|
||||
'Here, myString is created and equal ""
|
||||
|
||||
End Sub '==> Here the string is destructed !
|
||||
9
Task/Binary-strings/VBA/binary-strings-3.vba
Normal file
9
Task/Binary-strings/VBA/binary-strings-3.vba
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
Sub String_Assignment()
|
||||
Dim myString$
|
||||
'Here, myString is created and equal ""
|
||||
|
||||
'assignments :
|
||||
myString = vbNullString 'return : ""
|
||||
myString = "Hello World" 'return : "Hello World"
|
||||
myString = String(12, "A") 'return : "AAAAAAAAAAAA"
|
||||
End Sub
|
||||
28
Task/Binary-strings/VBA/binary-strings-4.vba
Normal file
28
Task/Binary-strings/VBA/binary-strings-4.vba
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
Sub String_Comparison_FirstWay()
|
||||
Dim A$, B$, C$
|
||||
|
||||
If A = B Then Debug.Print "A = B"
|
||||
|
||||
A = "creation": B = "destruction": C = "CREATION"
|
||||
|
||||
'test equality : (operator =)
|
||||
If A = B Then
|
||||
Debug.Print A & " = " & B
|
||||
'used to Sort : (operator < and >)
|
||||
ElseIf A > B Then
|
||||
Debug.Print A & " > " & B
|
||||
Else 'here : A < B
|
||||
Debug.Print A & " < " & B
|
||||
End If
|
||||
|
||||
'test if A is different from C
|
||||
If A <> C Then Debug.Print A & " and " & B & " are differents."
|
||||
'same test without case-sensitive
|
||||
If UCase(A) = UCase(C) Then Debug.Print A & " = " & C & " (no case-sensitive)"
|
||||
|
||||
'operator Like :
|
||||
If A Like "*ation" Then Debug.Print A & " Like *ation"
|
||||
If Not B Like "*ation" Then Debug.Print B & " Not Like *ation"
|
||||
'See Also :
|
||||
'https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/operators/like-operator
|
||||
End Sub
|
||||
6
Task/Binary-strings/VBA/binary-strings-5.vba
Normal file
6
Task/Binary-strings/VBA/binary-strings-5.vba
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
Sub String_Clone_Copy()
|
||||
Dim A As String, B$
|
||||
A = "Hello world!"
|
||||
'cloning :
|
||||
B = A
|
||||
End Sub
|
||||
23
Task/Binary-strings/VBA/binary-strings-6.vba
Normal file
23
Task/Binary-strings/VBA/binary-strings-6.vba
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
Sub Check_Is_Empty()
|
||||
Dim A As String, B As Variant
|
||||
|
||||
Debug.Print IsEmpty(A) 'return False
|
||||
Debug.Print IsEmpty(Null) 'return False
|
||||
Debug.Print IsEmpty(B) 'return True ==> B is a Variant
|
||||
|
||||
Debug.Print A = vbNullString 'return True
|
||||
Debug.Print StrPtr(A) 'return 0 (zero)
|
||||
|
||||
'Press the OK button without enter a data in the InputBox :
|
||||
A = InputBox("Enter your own String : ")
|
||||
Debug.Print A = "" 'return True
|
||||
Debug.Print IsEmpty(A) 'return False
|
||||
Debug.Print StrPtr(A) = 0 'return False
|
||||
|
||||
'Press the cancel button (with or without enter a data in the InputBox)
|
||||
A = InputBox("Enter your own String : ")
|
||||
Debug.Print StrPtr(A) = 0 'return True
|
||||
Debug.Print IsEmpty(A) 'return False
|
||||
Debug.Print A = "" 'return True
|
||||
'Note : StrPtr is the only way to know if you cancel the inputbox
|
||||
End Sub
|
||||
5
Task/Binary-strings/VBA/binary-strings-7.vba
Normal file
5
Task/Binary-strings/VBA/binary-strings-7.vba
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Sub Append_to_string()
|
||||
Dim A As String
|
||||
A = "Hello worl"
|
||||
Debug.Print A & Chr(100) 'return : Hello world
|
||||
End Sub
|
||||
6
Task/Binary-strings/VBA/binary-strings-8.vba
Normal file
6
Task/Binary-strings/VBA/binary-strings-8.vba
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
Sub ExtractFromString()
|
||||
Dim A$, B As String
|
||||
A = "Hello world"
|
||||
B = Mid(A, 3, 8)
|
||||
Debug.Print B 'return : llo worl
|
||||
End Sub
|
||||
7
Task/Binary-strings/VBA/binary-strings-9.vba
Normal file
7
Task/Binary-strings/VBA/binary-strings-9.vba
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Sub ReplaceInString()
|
||||
Dim A$, B As String, C$
|
||||
A = "Hello world"
|
||||
B = Chr(108) ' "l"
|
||||
C = " "
|
||||
Debug.Print Replace(A, B, C) 'return : He o wor d
|
||||
End Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue