TokenUpper()
Change the first letter of tokens to upper case
Syntax
TokenUpper( <[@]cString>, [<cTokenizer>], [<nTokenCount>], [<nSkipWidth>] ) -> cString
Arguments
<[@]cString> is the processed string
[<cTokenizer>] is a list of characters separating the tokens in <cString> Default: chr(0) + chr(9) + chr(10) + chr(13) + chr(26) + chr(32) + chr(32) + chr(138) + chr(141)+ “, .;:!\?/\\<>()#&%+-*”
[<nTokenCount>] specifies the number of tokens that should be processed Default: all tokens
[<nSkipWidth>] specifies the maximum number of successive tokenizing characters that are combined as ONE token stop, e.g. specifying 1 can yield to empty token Default: 0, any number of successive tokenizing characters are combined as ONE token stop
Returns
<cString> the string with the uppercased tokens
Description
The TokenUpper() function changes the first letter of tokens in <cString> to upper case. To do this, it uses the same tokenizing mechanism as the token() function. If TokenUpper() extracts a token that starts with a letter, this letter will be changed to upper case.
You can omit the return value of this function by setting the CSETREF() switch to .T., but you must then pass <cString> by reference to get the result.
Examples
? TokenUpper( "Hello, world, here I am!" ) // "Hello, World, Here I Am!" ? TokenUpper( "Hello, world, here I am!",, 3 ) // "Hello, World, Here I am!" ? TokenUpper( "Hello, world, here I am!", ",", 3 ) // "Hello, world, here I am!" ? TokenUpper( "Hello, world, here I am!", " w" ) // "Hello, wOrld, Here I Am!"
Tests
TokenUpper( "Hello, world, here I am!" ) == "Hello, World, Here I Am!" TokenUpper( "Hello, world, here I am!",, 3 ) == "Hello, World, Here I am!" TokenUpper( "Hello, world, here I am!", ",", 3 ) == "Hello, world, here I am!" TokenUpper( "Hello, world, here I am!", " w" ) == "Hello, wOrld, Here I Am!"
Compliance
TokenUpper() is compatible with CT3’s TokenUpper(), but a new 4th parameter, <nSkipWidth> has been added for synchronization with the the other token functions.
Platforms
All
Files
Source is token1.c, library is libct.
Seealso
TOKEN(), NUMTOKEN(), ATTOKEN(), TOKENLOWER(), TOKENSEP(), CSETREF()