String

Repeat a character n times.

Syntax
      String(Nunber, Character)

Key
   Character  A single character.
   N          The Number of repeated characters to return.

The String() function can be used in VBA or in an SQL query.

String() will return a Variant, you can also use String$() to return a String.
You should use String() if there is any chance of a Null value, since assigning Null to a String will raise an error.

Examples

Dim strDemo as String
strDemo = String(10, "A")
Msgbox strDemo
Returns "AAAAAAAAAA"

“Begin at the beginning, the King said, very gravely, and go on till you come to the end: then stop” ~ Lewis Carroll

Related:

Mid - Extract a substring from a string
Right - Extract a substring from a string


Copyright © SS64.com 1999-2018
Some rights reserved