preload

Service Functions – String / WinRunner

Posted by Albert Gareev on Mar 28, 2007
0
String / Text/ Date Functions In the code examples I present I often refer to routine functions. In my framework I have specialized libraries to call from. In my blog I maintain the similar structure. String/Text functions (WinRunner, TSL) Trim text line Check format String/Text functions 2 (WinRunner, TSL) Replace characters in a string Replace [...] ...

String/Date functions 2 (WinRunner, TSL)

Posted by Albert Gareev on Mar 26, 2007
0
Parent page: Service Functions – String / WinRunner Date to Dictionary public function str_date_split(in date, inout dtVector[]) {  delete dtVector[];  date = str_date_align(date);    dtVector["month"] = substr(date,1,2);  dtVector["day"] = substr(date,4,2);  dtVector["year"] = substr(date,7,4); } Date comparison # suppose dates are aligned # format is mm/dd/yyyy public function str_date_compare(in date1, in ...

String/Date functions (WinRunner, TSL)

Posted by Albert Gareev on Mar 24, 2007
0
Parent page: Service Functions – String / WinRunner Month Name/Number conversion static const month_number[] = {  "JAN" = "01",  "FEB" = "02",  "MAR" = "03",  "APR" = "04",  "MAY" = "05",  "JUN" = "06",  "JUL" = "07",  "AUG" = "08",  "SEP" = "09", ...

String/Text functions 5 (WinRunner, TSL)

Posted by Albert Gareev on Mar 22, 2007
0
Parent page: Service Functions – String / WinRunner CheckBox status value conversion static const string_cb_state[] = {  "ON" = ON,  "OFF" = OFF,  "DIMMED" = DIMMED,  "TOGGLE" = TOGGLE  }; ### static const integer_cb_state[] = {  ON = "ON",  OFF = "OFF",  DIMMED = "DIMMED",  TOGGLE = "TOGGLE"  }; ### public function int_cb_state(in cb_state) { [...] ...

String/Text functions 4 (WinRunner, TSL)

Posted by Albert Gareev on Mar 20, 2007
0
Parent page: Service Functions – String / WinRunner Find a substring defined by 2 tokens public function str_get_text(in s, in text_before, in text_after) {  auto index1, index2;  auto result;    if (text_before == "")   index1 = 1;  else    index1 = index(s, text_before);  if (index1 == 0)   return("");  else     index1 = index1 + length(text_before);    [...] ...

String/Text functions 3 (WinRunner, TSL)

Posted by Albert Gareev on Mar 18, 2007
0
Parent page: Service Functions – String / WinRunner Remove extra space and tab characters within a string public function str_shrink(in s, in separator) {  auto res, i, c, StringArray[];     res = str_trim(s);  if (res == "")   return(res);    res = str_replace(res, "\t", " ");  c = split(s, StringArray, " ");  if (c == 1)   return(StringArray[1]); [...] ...

String/Text functions 2 (WinRunner, TSL)

Posted by Albert Gareev on Mar 16, 2007
0
Parent page: Service Functions – String / WinRunner Replace characters in a string public function str_replace(in s, in sub1, in sub2) {  auto loc, start, sub1_len;  auto src, result;  src = s;  sub1_len = length(sub1);     result = "";  while (1) {   loc = index(src, sub1);   if (loc == 0)    break;   else {    result = [...] ...

String/Text functions (WinRunner, TSL)

Posted by Albert Gareev on Mar 14, 2007
0
Parent page: Service Functions – String / WinRunner Trim text line public function str_trim(in value) {  auto StringArray[];  if (length(value) == 0)   return (""); #if we have space chars only - let's do it quickly    if (index(value,"\t") == 0) {   if (split(value, StringArray, " ") == 1)    return(StringArray[1]);   }    return str_rtrim(str_ltrim(value));  } ### [...] ...

Link-a-log: VBScript coding

Posted by Albert Gareev on Mar 10, 2007
0
VB Helper: Tips, tricks, & example programs for Visual Basic developers Hey, Scripting Guy!  Great collection of VBScript examples with step by step explanations. Search archives. ...
Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported
This work by Albert Gareev is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported.