Full List
The following table lists all the functions that return a string data type.
| Function | Description |
| CHR$ | Returns the character with the corresponding ANSI number (String). |
| CHRB$ | Returns the character with the corresponding ANSI number (String). |
| CHRW$ | Returns the character with the corresponding ANSI number (String). |
| COMMAND$ | Returns the argument portion of the command line used to launch the application (String). |
| CURDIR$ | Returns the current path of a given drive (String). |
| DATE$ | Returns the current system date (String). |
| DIR$ | Returns the name of a file or directory matching a pattern or attribute (String). |
| ENVIRON$ | Returns information about the current operating system environment (String). |
| ERROR$ | Returns the error message corresponding to a given error number (String). |
| FORMAT$ | Returns the text string of a number or date in a particular format (String). |
| HEX$ | Returns the number converted to hexadecimal (String). |
| INPUT$ | Reads a number of characters from a file (String). |
| INSTR$ | Returns the position of a substring within a larger string (Long). |
| LCASE$ | Returns the text string with all characters converted to lowercase (String). |
| LEFT$ | Returns a number of characters from the left of a string (String). |
| LEFTB$ | Returns a number of characters from the left of a string (String). |
| LTRIM$ | Returns the text string without leading spaces (String). |
| MID$ | Returns the text string which is a substring of a larger string (String). |
| MIDB$ | Returns the text string which is a substring of a larger string (String). |
| OCT$ | Returns the number converted to octal (Variant). |
| REPLACE$ | Returns the text string with a number of characters replaced (String). |
| RIGHT$ | Returns the number of characters from the right of a text string (String). |
| RIGHTB$ | Returns the number of characters from the right of a text string (String). |
| RTRIM$ | Returns the text string without trailing spaces (String). |
| SPACE$ | Returns the specified number of spaces (String). |
| STR$ | Returns the text string of a number (String). |
| STRCOMP$ | Returns the result of a string comparison (Integer). |
| STRING$ | Returns a repeating character of a given length (String). |
| TRIM$ | Returns the text string removing leading and trailing spaces (String). |
| UCASE$ | Returns the text string with all the characters converted to uppercase (String). |
Exceptions - DATE$
The Date function should always be used because the Date$ function doesn't behave correctly.
The Date$ always returns information in mm-dd-yyyy format regardless of the Windows localization settings, whereas the Date function uses the localization settings.
Exceptions - REPLACE$
The Replace function always creates a copy of the input string, even if no replacement occurs.
Making a copy of the input string is a slow operation and should be avoided if possible.
If a replacement is unlikely, check first (with InStr or InStrB) and only use the Replace function when absolutely necessary.
If a replacement is likely or certain to occur then just use the Replace function (no need to check first).
Dim sText As String
Dim sToBeReplaced As String
If InStr(sText, sToBeReplaced) <> 0 Then
sText = Replace(sText, sToBeReplaced, "abc")
End If
Because this function always makes a copy of the input string there is no difference between Replace and Replace$.
FORMAT
Because you will always want to use the FORMAT function to create a string containing a date, you should never use the DATE$ function.
Do not allow a variable of type Date to be implicitly converted into a string. In both cases use the FORMAT$ function to explicitly convert the date into a string
© 2025 Better Solutions Limited. All Rights Reserved. © 2025 Better Solutions Limited TopPrevNext