String

ampersand

& - ampersand Generates a string concatenation of two expressions.

Constants Fields

vbNewLine - Represents a newline character for print and display functions.

vbTab - Represents a tab character for print and display functions.

Strings.Format Method

String replace code

{0} - String.Format function returns the fully composed String.

Currency, C, or c

Displays number with thousand separator, if appropriate; displays two digits to the right of the decimal separator. Output is based on system locale settings.

For example, Format(1234567, "c") returns $1,234,567.00.

P, or p

Displays number with thousandths separator multiplied by 100 with a percent sign (%) appended to the right and separated by a single space; always displays two digits to the right of the decimal separator.

Standard, N, or n

Displays number with thousand separator, at least one digit to the left and two digits to the right of the decimal separator.

For example, Format(1234567, "n") returns 1,234,567.00.

Custom Numeric Format Strings

"#" custom format specifier

The "#" custom format specifier serves as a digit-placeholder symbol. If the value that is being formatted has a digit in the position where the "#" symbol appears in the format string, that digit is copied to the result string. Otherwise, nothing is stored in that position in the result string.

Note that this specifier never displays a zero that is not a significant digit, even if zero is the only digit in the string. It will display zero only if it is a significant digit in the number that is being displayed.

The "##" format string causes the value to be rounded to the nearest digit preceding the decimal, where rounding away from zero is always used. For example, formatting 34.5 with "##" would result in the value 35.

CStr

converts literals into Strings.

StringBuilder

is an optimization. A class, it improves common String operations.
Appending,
replacing
and inserting are faster. It is easy to use. With it, we can convert our data back into a String.

The String object is immutable. Every time you use one of the methods in the System.String class, you create a new string object in memory, which requires a new allocation of space for that new object. In situations where you need to perform repeated modifications to a string, the overhead associated with creating a new String object can be costly. The System.Text.StringBuilder class can be used when you want to modify a string without creating a new object. For example, using the StringBuilder class can boost performance when concatenating many strings together in a loop.