|
The following is a list of string functions that can be used when writing Templates or Scripts.
double Atof( const char s[] )
Converts a string to a floating-point number. Returns zero on error.
int Atoi( const char s[] )
Converts a string to an integer. Returns zero on error.
string DosDateToString( DOSDATE d )
Converts the given DOSDATE into a string and returns the results. The date will be in the format
'MM/dd/yyyy'. Click here for more information on the DOSDATE type and see the
FileTimeToString function for an example of using SScanf to parse the resulting string.
string DosTimeToString( DOSTIME t )
Converts the given DOSTIME into a string and returns the results. The time will be in the format
'hh:mm:ss'. Click here for more information on the DOSTIME type and see the
FileTimeToString function for an example of using SScanf to parse the resulting string.
string EnumToString( enum e )
If the given variable e is an enum, the value is converted into the string which represents that enum value and returned. The enum may be a constant or an enum variable. For example:
enum { FIRST, SECOND, THIRD } value;
string s1, s2;
value = SECOND;
s1 = EnumToString( THIRD ); //s1 = "THIRD"
s2 = EnumToString( value ); //s2 = "SECOND"
Note that if e is a valid enum but no string corresponds to that enum value, an empty string is returned.
string FileTimeToString( FILETIME ft )
Converts the given FILETIME into a string and returns the results. The time will be in the format
'MM/dd/yyyy hh:mm:ss'. Click here for more information on the FILETIME type. The resulting string can be separated into parts using the SScanf function. For example:
int hour, minute, second, day, month, year;
string s = FileTimeToString( ft );
SScanf( s, "%02d/%02d/%04d %02d:%02d:%02d",
month, day, year, hour, minute, second );
year++;
SPrintf( s, "%02d/%02d/%04d %02d:%02d:%02d",
month, day, year, hour, minute, second );
int Memcmp( const uchar s1[], const uchar s2[], int n )
Compares the first n bytes of s1 and s2. Returns a value less than zero if s1 is less than s2, zero if they are equal, or a value greater than zero if s1 is greater than s2.
void Memcpy( uchar dest[], const uchar src[], int n )
Copies a block of n bytes from src to dest.
void Memset( uchar s[], int c, int n )
Sets the first n bytes of s to the byte c.
string OleTimeToString( OLETIME ot )
Converts the given OLETIME into a string and returns the results. The time will be in the format
'MM/dd/yyyy hh:mm:ss'. Click here for more information on the OLETIME type and see the
FileTimeToString function for an example of using SScanf to parse the resulting string.
int SPrintf( char buffer[], const char format[] [, argument, ... ] )
Performs a Printf starting from format and places the result into buffer. See Printf for more information.
int SScanf( char str[], char format[], ... )
This function parses the str parameter into a number of variables according to the
format string. The format string uses the same specifiers as the Printf function. Following the format must be a list of arguments, one for each format specifier in the format string. Note that unlike the regular C function, do not use '&' for each argument. For example:
int a, b;
SScanf( "34, 62", "%d, %d", a, b );
would read the value 34 and 62 into a and b. The return value will be the number of successfully read arguments (in this example the return value would be 2).
void Strcat( char dest[], const char src[] )
Appends the characters from src to the end of the string dest. The string may be resized if necessary. The += operator can also be used for a similar result.
int Strchr( const char s[], char c )
Scans the string s for the first occurrence of the character c. Returns the index of the match, or -1 if no characters match.
int Strcmp( const char s1[], const char s2[] )
Compares the one string to another. Returns a value less than zero if s1 is less than s2, zero if they are equal, or a value greater than zero if s1 is greater than s2.
void Strcpy( char dest[], const char src[] )
Copies string src to string dest, stopping when the null-character has been copied.
char[] StrDel( const char str[], int start, int count )
Removes count characters from str starting at the index start and
returns the resulting string.
int Stricmp( const char s1[], const char s2[] )
Identical to Strcmp except the strings are compared without case sensitivity.
int StringToDosDate( string s, DOSDATE &d )
Converts the given string into a DOSDATE and stores the results in d. The string should be in the format 'MM/dd/yyyy'. This function returns true if it succeeds. More information on date types is available here.
int StringToDosTime( string s, DOSTIME &t )
Converts the given string into a DOSTIME and stores the results in t. The string should be in the format 'hh:mm:ss'. This function returns true if it succeeds. More information on date types is available here.
int StringToFileTime( string s, FILETIME &ft )
Converts the given string into a FILETIME and stores the results in ft. The string should be in the format 'MM/dd/yyyy hh:mm:ss'. This function returns true if it succeeds. More information on date types is available here.
int StringToOleTime( string s, OLETIME &ot )
Converts the given string into an OLETIME and stores the results in ot. The string should be in the format 'MM/dd/yyyy hh:mm:ss'. This function returns true if it succeeds. More information on date types is available here.
int StringToTimeT( string s, time_t &t )
Converts the given string into a time_t and stores the results in t. The string should be in the format 'MM/dd/yyyy hh:mm:ss'. This function returns true if it succeeds. More information on date types is available here.
wstring StringToWString( const char str[] )
Converts the given ASCII string str into a wide (unicode) string. See
Arrays and Strings for information on wide
strings and note that wstring and wchar_t[] are equivalent.
Requires 010 Editor v3.1 or higher.
int Strlen( const char s[] )
Returns the number of characters in s before the null-character.
int Strncmp( const char s1[], const char s2[], int n )
Similar to Strcmp, except that no more than n characters are compared.
void Strncpy( char dest[], const char src[], int n )
Similar to Strcpy, except that at most n characters will be copied.
int Strnicmp( const char s1[], const char s2[], int n )
Similar to Strcmp except that at most n characters are compared and the characters are compared without case sensitivity.
int Strstr( const char s1[], const char s2[] )
Scans the string s1 for the first occurrence of s2. Returns the index of the first matching character, or -1 if no match is found.
char[] SubStr( const char str[], int start, int count=0 )
Returns a string containing count characters from str starting at the index start. If count is zero, all the characters from the start index to the end of the string are returned.
string TimeTToString( time_t t )
Converts the given time_t into a string and returns the results. The time will be in the format
'MM/dd/yyyy hh:mm:ss'. Click here for more information on the time_t type and see the
FileTimeToString function for an example of using SScanf to parse the resulting string.
void WMemcmp( const wchar_t s1[], const wchar_t s2[], int n )
Compares the first n wchar_t items of the arrays s1 and s2. This function returns
a value less than zero if s1 is less than s2, zero if they are equal, or a value greater
than zero if s1 is greater than s2.
Requires 010 Editor v3.1 or higher.
void WMemcpy( wchar_t dest[], const wchar_t src[], int n )
Copies the first n wchar_t items from the array src to the array dest.
Requires 010 Editor v3.1 or higher.
void WMemset( wchar_t s[], int c, int n )
Sets the first n wchar_t items of the array s to the value c.
Requires 010 Editor v3.1 or higher.
void WStrcat( wchar_t dest[], const wchar_t src[] )
Appends all characters from the src string to the end of the
dest string. Note that the string may be resized if required and
the += operator can also be used for a similar result.
Requires 010 Editor v3.1 or higher.
int WStrchr( const wchar_t s[], wchar_t c )
Searchs through the string s for the first occurrence of the character c.
If the character is found, this function returns the index of the match,
otherwise -1 is returned.
Requires 010 Editor v3.1 or higher.
int WStrcmp( const wchar_t s1[], const wchar_t s2[] )
Use this function to compare one wide string to another.
Returns a value less than zero if s1 is less than s2,
zero if they are equal, or a value greater than zero if s1 is greater than s2.
Requires 010 Editor v3.1 or higher.
void WStrcpy( wchar_t dest[], const wchar_t src[] )
Copies the string src to the string dest, stopping
when the null-character has been copied.
Requires 010 Editor v3.1 or higher.
wchar_t[] WStrDel( const whar_t str[], int start, int count )
Returns a string where count characters have been
removed from the string str
starting at the index start. Note that the str argument is not modified.
Requires 010 Editor v3.1 or higher.
int WStricmp( const wchar_t s1[], const wchar_t s2[] )
Identical to WStrcmp except the strings are compared without case sensitivity.
Requires 010 Editor v3.1 or higher.
char[] WStringToString( const wchar_t str[] )
Converts the given wide string str into an ASCII string and returns it.
Note that not all characters can be successfully converted from wide characters
to ASCII characters and any characters that cannot be converted will be replaced with
the '?' character. See
Arrays and Strings for information on wide
strings and note that wstring and wchar_t[] are equivalent.
Requires 010 Editor v3.1 or higher.
int WStrlen( const wchar_t s[] )
Counts the number of characters in s before the null-character
is encountered and returns the result.
Requires 010 Editor v3.1 or higher.
int WStrncmp( const wchar_t s1[], const wchar_t s2[], int n )
Similar to WStrcmp, except that at most n characters are compared between the two strings.
Requires 010 Editor v3.1 or higher.
void WStrncpy( wchar_t dest[], const wchar_t src[], int n )
Similar to WStrcpy, except that at most n
characters will be copied.
Requires 010 Editor v3.1 or higher.
int WStrnicmp( const wchar_t s1[], const wchar_t s2[], int n )
Similar to WStrcmp except that at most n characters are compared and the characters are compared without case sensitivity.
Requires 010 Editor v3.1 or higher.
int WStrstr( const wchar_t s1[], const wchar_t s2[] )
Searches through the wide string s1 for the first
occurrence of the string s2. If the string is found, the index of the first matching character
is returned, otherwise -1 is returned.
Requires 010 Editor v3.1 or higher.
wchar_t[] WSubStr( const wchar_t str[], int start, int count=0 )
Returns a wide string containing count characters from
str starting at the index start.
If count is zero, all the characters from
the start index to the end of the string are returned.
Requires 010 Editor v3.1 or higher.
|