Position
Position will find the occurance of a given fragment after the start offset.
__int64 Position( const BYTE *search, __int64 start = 0 ); __int64 Position( const char16_t *search, __int64 start = 0 ); __int64 Position( const TVariable &search, __int64 start = 0, int atom = 0 /*autosense*/ );
Parameters
search | the pattern string to match. The TVariable version can match arrays of string and will return the position of the first match. |
start | this is the byte offset of the start location. If start is negative, the returned string will start at the start 'th character from the end of string and search backward. |
atom | this is the size of the blocks to match, for astring atom is 1 and for wstring it is 2. |
Return Values
If the fragment is not matched, then -1 is returned, otherwise the byte offset of the next location of the fragment after the start position.
Remarks
Example Use
- C++
#include "TScript.h" int wmain(int argc, wchar_t* argv[]) { TVariable var("123"); int pos = var.Position("2");//return - The value is 1 pos = var.Position(Bx00);//return - The value is 3 return NO_ERROR; }
Since
TScript Version 1.1.0
Also See
Copy, Substring, StringReplaceListen All
Comments (0)