SEARCHB
Returns the location of the specified substring in a string and is intended for languages that use the double-byte character set (DBCS) like Japanese, Chinese, Korean etc.
Syntax
expression.SEARCHB(arg1, arg2, arg3);
expression - A variable that represents a ApiWorksheetFunction class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| arg1 | Required | ApiRange | ApiName | string | The text to find. The ? and * wildcard characters can be used. Use ~? and ~* to find the ? and * characters. | |
| arg2 | Required | ApiRange | ApiName | string | The text where to search for the specified text. | |
| arg3 | Optional | ApiRange | ApiName | number | The character number in the search text, counting from the left, at which to start searching. If omitted, 1 is used. |
Returns
number
Example
This example shows how to return the location of the specified substring in a string and is intended for languages that use the double-byte character set (DBCS) like Japanese, Chinese, Korean etc.
- Code
- Result
// How to get number of characters counting from the first occurance of search text for double-byte character set languages.
// Use a function to count characters starting from the index at which the search text appears.
let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("A1").SetValue(func.SEARCHB("line", "Online Office"));