Difference between revisions of "Documentation/DevGuide/Basic/String Functions"
From Apache OpenOffice Wiki
< Documentation | DevGuide
OOoWikiBot (talk | contribs) m (Robot: Changing Category:Documentation/Developers Guide/Basic and Dialogs) |
(A bit more) |
||
| Line 9: | Line 9: | ||
{{PRODUCTNAME}} Basic supports several runtime functions for string manipulation. Some of the functions are explained briefly in the following: | {{PRODUCTNAME}} Basic supports several runtime functions for string manipulation. Some of the functions are explained briefly in the following: | ||
| − | * <code>Asc</code> returns | + | * <code>Asc</code> returns the Unicode value of the first character of its string parameter. |
| − | * <code>Chr</code> returns a string containing the character that is specified by the ASCII or Unicode value passed to the function. This function is used to represent characters, such as | + | * <code>Chr</code> returns a string containing the character that is specified by the ASCII or Unicode value passed to the function. This function is used to represent characters, such as the carriage return code (<code>Chr(13)</code>), that cannot be written in the "" notation. This is not necessary for the " character, which can be included in a string literal by simply doubling it, eg. <code>s = "This string has ""embedded"" quotes"</code> |
| − | * <code>Str</code> converts a numeric expression to a string. | + | * <code>Str</code> converts a numeric expression to a string in a locale-independent manner (contrary to the <code>CStr</code> function). |
* <code>Val</code> converts a string to a numeric value. | * <code>Val</code> converts a string to a numeric value. | ||
* <code>LCase</code> converts all letters in a string to lowercase. Only uppercase letters within the string are converted. All lowercase letters and nonletter characters remain unchanged. | * <code>LCase</code> converts all letters in a string to lowercase. Only uppercase letters within the string are converted. All lowercase letters and nonletter characters remain unchanged. | ||
| Line 19: | Line 19: | ||
* <code>Right</code> returns the rightmost "n" characters of a string expression. | * <code>Right</code> returns the rightmost "n" characters of a string expression. | ||
* <code>Trim</code> removes all leading and trailing spaces of a string expression. | * <code>Trim</code> removes all leading and trailing spaces of a string expression. | ||
| − | + | All these functions are fully compatible with VBA and all functions returning a string can be specified with a trailing $ like <code>Mid$</code>. | |
{{PDL1}} | {{PDL1}} | ||
[[Category:Documentation/Developer's Guide/Basic and Dialogs]] | [[Category:Documentation/Developer's Guide/Basic and Dialogs]] | ||
Revision as of 15:49, 23 July 2008
OpenOffice.org Basic supports several runtime functions for string manipulation. Some of the functions are explained briefly in the following:
Ascreturns the Unicode value of the first character of its string parameter.Chrreturns a string containing the character that is specified by the ASCII or Unicode value passed to the function. This function is used to represent characters, such as the carriage return code (Chr(13)), that cannot be written in the "" notation. This is not necessary for the " character, which can be included in a string literal by simply doubling it, eg.s = "This string has ""embedded"" quotes"Strconverts a numeric expression to a string in a locale-independent manner (contrary to theCStrfunction).Valconverts a string to a numeric value.LCaseconverts all letters in a string to lowercase. Only uppercase letters within the string are converted. All lowercase letters and nonletter characters remain unchanged.UCaseconverts characters in a string to uppercase. Only lowercase letters in a string are affected. Uppercase letters and all other characters remain unchanged.Leftreturns the leftmost “n” characters of a string expression.Midreturns the specified portion of a string expression.Rightreturns the rightmost "n" characters of a string expression.Trimremoves all leading and trailing spaces of a string expression.
All these functions are fully compatible with VBA and all functions returning a string can be specified with a trailing $ like Mid$.
| Content on this page is licensed under the Public Documentation License (PDL). |