-
When the interpreter is wrong.
If there is a relevant character in the instr, it returns the location, and if it does not exist, it returns 0
No negative numbers are returned.
-
What language is the function in?
-
Returning 2 means that it has been found, that is, the match is successful, and the position subscript is 2
All non-0 and non-negative numbers indicate that the match was successful, and the start of the match is returned.
-
instr returns the position where the specified string appears first in the target string. Such as:
a=instr("abcdabcd","bc"Result a=2
The instr function returns the position where a string appears first in another string.
In string1, start to find string2, omit start to find string1, start to find from the first character of string1, when you can't find it, the function returns a value of 0, and if you find it, it returns its location.
-
instr([start, ]string1, string2[, compare])
Returns the position where a specified string appears first in another string. In string1, start with string2 and omit start from the first character of string1. If it cannot be found, the function returns a value of 0, and if it is found, it returns its location.
Returns a positive integer variant(long).
-
Return 3, the first parameter specifies where to start the search.
So start looking for it from position 2, that is"Text files"of this string"Ben"This location.
At this time, the position of the first text has been crossed, so the position of the second text is found, which is 3instr(1,"Text files","text") or instr("Text files","text") returns 1
-
It's you who misunderstood! There was never a start > string2! It only says that if start is greater than the length of string1, it will return 0.
It's easy to understand: if a string is 10 in length, but the start of the lookup is greater than 10, you can't find anything!
Returning 0 means that it is not found, and you only need to determine whether the return value is 0 in your program to determine whether string2 is included in string1.
-
start: an optional parameter. For numeric expressions, set the starting point for each search. If omitted, it will start with the position of the first character. If start contains null, an error will occur. If specified.
compare parameter, there must be a start parameter.
compare: an optional parameter. Specifies a string comparison. If compare is null, an error will occur. If omitted.
Compare, option compare's settings will determine the type of comparison.
Starting at the start position, look for string2 in string1 and return 0 if it doesn't find it. If string1 or.
If string2 is null, null is returned, and in other cases, string2 is returned at the starting position in string1.
I don't know if [if start > string2, then the function returns 0] This subject is seen in **? It is recommended that the relevant information be learned from Microsoft's official channels, which is more accurate and reliable.
-
Example of the instr function.
This example uses the instr function to find where a string first appears in another string.
dim searchstring, searchchar, mypos
searchchar = "p" 'To find a string"p"。
Starting with the fourth character, start by comparing the text. The return value is 6 (lowercase p).
Lowercase p and uppercase p are the same in text comparison.
mypos = instr(4, searchstring, searchchar, 1)
Start with the first character and find it in the way of binary comparison. The return value is 9 (uppercase p).
Lowercase p and uppercase p are not the same in binary comparison.
mypos = instr(1, searchstring, searchchar, 0)
The default comparison method is binary comparison (the last parameter can be omitted).
mypos = instr(searchstring, searchchar) 'Return 9.
mypos = instr(1, searchstring, "w") 'Returns 0.
-
The return value is 3
Starting from the second character, find the position of the character "文" in the string of "text file".
Since it starts from the second one, it is the third character that is the character "文". So the return value is 3
-
Go back to 3 and start looking for the second position to find the third character.
-
Because its result is 0, it can never be found, so it returns 0.
If the main function does not end with a return statement, C specifies that the compiler will automatically add a return to the generated object file to indicate that the program exits normally. However, I would suggest that you add a return statement to the end of the main function, about void main In C and C++, the prototype of the function that does not receive any arguments and does not return any information is "void foo(void); Probably because of this, many people mistakenly think that if the program doesn't need to return any information, they can define the main function as void main(void). However, this is wrong! >>>More
The maximum value problem of conic curves is commonly solved by the following methods: >>>More
The crime of bigamy refers to the act of marrying another person while the perpetrator has a spouse, or marrying another person knowing that he or she has a spouse. >>>More
Under what circumstances can the property be frozenPersonal property is personal property, but sometimes the court can freeze the property. >>>More
What do you call it in Chinese? ”
what(h)wɔt] >>>More