General/Strings
m (moved VEX2 Functions Strings to General/Strings) |
(→sprintf) |
||
| Line 45: | Line 45: | ||
| style="border-style: solid; border-width: 1px 0px 1px 0px"|''&sString'' | | style="border-style: solid; border-width: 1px 0px 1px 0px"|''&sString'' | ||
| style="border-style: solid; border-width: 1px 0px 1px 0px"|This is the destination string. | | style="border-style: solid; border-width: 1px 0px 1px 0px"|This is the destination string. | ||
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|[[Data_Types# | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|[[Data_Types#dataType_string|string]] |
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|''sFormatString, ...'' | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sFormatString, ...'' | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|These are the source strings. | | style="border-style: solid; border-width: 0px 0px 0px 0px"|These are the source strings. | ||
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[Data_Types# | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[Data_Types#dataType_string|string]] |
|- | |- | ||
|} | |} | ||
Revision as of 07:31, 21 May 2012
| For information about displaying on the NXT LCD, please see the article: NXT Display Functions.
For information about displaying on the VEX LCD, please see the article: Cortex Display Functions.
The number before the decimal is how many digits before the decimal you wish to display, while the number after the decimal is how many digits after the decimal you wish to display. So "%1.2f" tells us to display one digit before the decimal and two digits after the decimal, with "3.14" as the final result. |
|
| |||||||
sprintf
|
void sprintf ( string &sString , const string sFormatString , ... ) | |||||||||
| (void) This function writes the data from sFormatString to &sString. Identical to the function found in conventional C 'string.h' library. | |||||||||
| |||||||||
|
strcat
|
void strcat ( void &pToBuffer , const void &pFromBuffer ) | |||||||||
| (void) Function concatenates pFromBuffer onto end of pToBuffer. The variables are arrays of bytes terminated with zero character. It is user responsibility to ensure that the 'To' array is large enough to hold the result. ROBOTC is not able to do any range checking! Identical to the function found in conventional C 'string.h' library. | |||||||||
| |||||||||
|
strcmp
|
short strcmp ( void &pString1 , const void &pString2 ) | |||||||||
| (short) Function compares pString1 with pString2. Returns negative value if less than, 0 if equal and positive value if greater than. The variables are arrays of bytes terminated with a zero char. Identical to the function found in conventional C 'string.h' library. | |||||||||
| |||||||||
|
strcpy
|
void strcpy ( void &pToBuffer , const void &pFromBuffer ) | |||||||||
| (void) Function copies pFromBuffer to pToBuffer. The variables are arrays of bytes terminated with a zero character. It is user responsibility to ensure that the 'To' array is large enough to hold the result. ROBOTC is not able to do any range checking! Identical to the function found in conventional C 'string.h' library. | |||||||||
| |||||||||
|
StringDelete
|
void StringDelete ( string &sDest , const int nIndex , const int nSize ) | ||||||||||||
| (void) Deletes a substring from a string. | ||||||||||||
| ||||||||||||
|
StringFind
|
int StringFind ( const string &sSrce , const string &sSearch ) | |||||||||
| (int) Finds the position in a string of the selected substring. | |||||||||
| |||||||||
|
StringFormat
|
void StringFormat ( string &sDest , const string sFormatString , ... ) | |||||||||
| (void) Formats a string using the specified format-string. | |||||||||
| |||||||||
|
StringFromChars
|
void StringFromChars ( string &sToString , const char &FromChars ) | |||||||||
| (void) Converts an array of bytes to a string value. You MUST end your char array with a char value of zero! | |||||||||
| |||||||||
|
strncat
|
void strncat ( void &pToBuffer , const void &pFromBuffer , const short nMaxBufferSize ) | ||||||||||||
| (void) Function concatenates pFromBuffer onto end of pToBuffer. The variables are arrays of bytes terminated with a zero character. nMaxBufferSize is the maximum size of ‘pFromBuffer’ and is usually created with a sizeof(..) function call. Identical to the function found in conventional C 'string.h' library file. | ||||||||||||
| ||||||||||||
|
strncmp
|
short strncmp ( void &pString1 , const void &pString2, const short nMaxBufferSize ) | ||||||||||||
| (short) Function compares pString1 with pString2. Returns negative value if less than, 0 if equal and positive value if greater than. The variables are arrays of bytes terminated with a zero char. nMaxBufferSize is the maximum number of bytes to compare and is usually created with a sizeof(..) function call. Identical to the function found in conventional C 'string.h' | ||||||||||||
| ||||||||||||
|