Returns the starting position in bytes of the first instance of
haystack. Returns null if
needle is not in
haystack. Counting starts from 1 (not 0).
Always counts in the natural direction of the advertiser’s locale.
Intended mainly for languages that do not use a Latin character set, such as Japanese and Chinese. If the string or inventory attribute is in a language that uses a Latin, single-byte character set, such as English,
searchb returns the same value as search.
Learn more about syntax for functions.
haystack can be any of the following:
- A String constant, such as "GDN".
An inventory attribute or formula column that returns a string.
Learn more about referring to inventory attributes.
Text searches are case insensitive.
If you include an expression or formula column in this function, the expression or formula column could evaluate to an empty string.
Be aware that searching for an empty string always returns 1. That is,
searchb("", "GDN") evaluates to 1.
searchb("Δ", "ΓaΔbΘc")returns 4, which is the starting byte of the 3rd character. (The first character of haystack is 2 bytes, and the second character is 1 byte.)
searchb("a", "ΓaΔbΘc")returns 3, which is the starting byte of the 2nd character.
searchb("ー", "スニーカー")returns 5, which is the location of the first
ーwhen counting bytes in a double-byte character set.
searchb("", "ΓaΔbΘc")returns 1 because the function is searching for an empty string. Note that searching for an empty string returns 1, even though first character is 2 bytes