CyberCodes
Mid , Instr , InstrRev Function Welcome

Reminders sa mga rehistradong myembro:

•ang lengwahe na gagamitin ay pawang english at tagalog lamang

•Bawal po dito ang pakikipag away

•Bawal ang mga shorcut na mga words
Example: txt, Pwd, at iba pa

•Bawal mababastos at masasakit na salita o anu mang makakasakit
ng damdamin ng isang myembro ng forum na ito

•use the "like" button if the post of the following user you think are usefull



Join the forum, it's quick and easy

CyberCodes
Mid , Instr , InstrRev Function Welcome

Reminders sa mga rehistradong myembro:

•ang lengwahe na gagamitin ay pawang english at tagalog lamang

•Bawal po dito ang pakikipag away

•Bawal ang mga shorcut na mga words
Example: txt, Pwd, at iba pa

•Bawal mababastos at masasakit na salita o anu mang makakasakit
ng damdamin ng isang myembro ng forum na ito

•use the "like" button if the post of the following user you think are usefull

CyberCodes
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Mid , Instr , InstrRev Function

Go down

Mid , Instr , InstrRev Function Empty Mid , Instr , InstrRev Function

Post by princeterror Sat Jul 21, 2012 2:03 am

Arrow 1 Idea
Function: Mid$ (or Mid)
Description: Returns a substring containing a specified number of characters from a string.

Syntax: Mid$(string, start[, length])

The Mid$ function syntax has these parts:
string Required. String expression from which characters are returned.
start Required; Long. Character position in string at which the part to be taken begins. If start is greater than the number of characters in string, Mid returns a zero-length string ("").
length Optional; Long. Number of characters to return. If omitted or if there are fewer than length characters in the text (including the character at start), all characters from the start position to the end of the string are returned.

Example:
Code:
strSubstr  = Mid$("Visual Basic", 3, 4)
' strSubstr = "sual"

Arrow 2 Idea
Function: Instr
Description: Returns a Long specifying the position of one string within another. The search starts either at the first character position or at the position specified by the start argument, and proceeds forward toward the end of the string (stopping when either string2 is found or when the end of the string1 is reached).

Syntax: InStr([start,] string1, string2 [, compare])

The InStr function syntax has these parts:
start Optional. Numeric expression that sets the starting position for each search. If omitted, search begins at the first character position. The start argument is required if compare is specified.
string1 Required. String expression being searched.
string2 Required. String expression sought.
compare Optional; numeric. A value of 0 (the default) specifies a binary (case-sensitive) search. A value of 1 specifies a textual (case-insensitive) search.


Examples
Code:
lngPos = Instr("Visual Basic", "a")
' lngPos = 5
lngPos = Instr(6, "Visual  Basic", "a")
' lngPos = 9        (starting at position 6)
lngPos = Instr("Visual Basic", "A")
' lngPos = 0        (case-sensitive search)
lngPos = Instr(1, "Visual  Basic", "A", 1)
' lngPos = 5        (case-insensitive search)

Arrow 3 Idea
Function: InstrRev
Description: Returns a Long specifying the position of one string within another. The search starts either at the last character position or at the position specified by the start argument, and proceeds backward toward the beginning of the string (stopping when either string2 is found or when the beginning of the string1 is reached).
Introduced in VB 6.

Syntax:InStrRev(string1, string2[, start, [, compare]])

The InStr function syntax has these parts:
string1 Required. String expression being searched.
string2 Required. String expression sought.
start Optional. Numeric expression that sets the starting position for each search. If omitted, search begins at the last character position.
compare Optional; numeric. A value of 0 (the default) specifies a binary (case-sensitive) search. A value of 1 specifies a textual (case-insensitive) search.

Example:
Code:
ngPos = InstrRev("Visual  Basic", "a")
' lngPos = 9
lngPos = InstrRev("Visual Basic", "a", 6)
' lngPos = 5          (starting at position 6)
lngPos = InstrRev("Visual Basic", "A")
' lngPos = 0          (case-sensitive search)
lngPos = InstrRev("Visual Basic", "A", , 1)
' lngPos = 9          (case-insensitive search)
' Note that this last example leaves a placeholder for the start argument
princeterror
princeterror
Universal Moderator
Universal Moderator

Posts : 272
Credits : 11465
Fame : 81
Join date : 2012-06-07
Age : 33

Back to top Go down

Mid , Instr , InstrRev Function Empty Re: Mid , Instr , InstrRev Function

Post by princeterror Sat Jul 21, 2012 2:10 am

Tagalog Explanations for newbies

Code:
'1 2  3 4 5 6 7
'I T C O D E S


Private Sub Command1_Click()

MsgBox Mid(Text1.Text, 6, Len(Text1.Text))

'MID FUNCTION = Mid(String,Start as Long,[Length])


'text1.Text ay "ITCODES"
'starting position ay 6
'tas ang length ay  Len(Text1.Text) <- length ng "ITCODES" which is 7


' bale eto yun
' Mid("ITCODES", 6, 7)



End Sub

Private Sub Command2_Click()
'INSTR FUNCTION = Instr(Start, [String1], [String2])

'hahanapin nten yung position ng word na "OD"
Dim X As Integer
X = InStr(1, Text1.Text, "OD")

'bale starting position nten sa pag hahanap ay 1
'Text1.Text = "ITCODES" diba

'bale eto yun
'InStr(1, "ITCODES", "OD")
'nsa 4th position yung "o" tas nsa 5th position yung "y"
'bale ang position ng "oy" ay 4th

MsgBox X

End Sub

princeterror
princeterror
Universal Moderator
Universal Moderator

Posts : 272
Credits : 11465
Fame : 81
Join date : 2012-06-07
Age : 33

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum