Break the given string into prefix string and a terminating integer.
int string_to_prefix_end_number( LPSTR lpszBuffer, LPCTSTR lpcszString )
returns the end number, or 0 if not terminating with numeric.
EX1
// This is a self contained sample program for the function string_to_prefix_end_number, // Its sample data is created at the beginning of the program. // To run the program, enter the following command in the Script window: // string_to_prefix_end_number_ex1 // This will return a message like following: // Created Workbook Name="Book7" ==> Prefix="Book" Enumeration=7 // void string_to_prefix_end_number_ex1() { int nn; char szBuffer[MAXLINE]; Worksheet wks; wks.Create(); String szString=wks.GetPage().GetName(); // workbook name as an input string nn = string_to_prefix_end_number(szBuffer,szString); //Demonstration of string_to_prefix_end_number if(lstrlen(szBuffer) != szString.GetLength()) // test if not broken up printf("Created Workbook Name=\"%s\" ==> Prefix=\"%s\" Enumeration=%d\n",szString,szBuffer,nn); else printf("Error: string_to_prefix_end_number failed to break up %s.\n",szString); }
break the given string into prefix string and a terminating integer. If the string is terminating with 0, then the return value will be zero. In this case,you will need to compare the resulting prefix string with the original string to see if it was indeed broken up. This function supports a largest termination value of 99999.
origin.h