Skip to content

String Function

Paul Squires edited this page Oct 19, 2026 · 2 revisions

Home › String Functions › String (Function)

String (Function)

Returns a string of n copies of one character.

Syntax

Declare Function String ( ByVal count As Integer, ByVal ch_code As Long ) As String
Declare Function String ( ByVal count As Integer, ByRef ch As Const String ) As String

Parameters

  • count
  • ch_code
  • ch

Description

The String function returns a string with a length of count, filled with a given ch_code or ch.

Return Value

The created string. An empty string will be returned if either ch is an empty string, or count <= 0.

Remarks

Usage

result = String[$]( count, ch_code )orresult = String[$]( count, ch )

Dialect Differences

  • The string type suffix "$" is required in the -lang qb dialect. The string type suffix "$" is optional in the -lang fblite dialect.
    The string type suffix "$" is ignored in the -lang fb dialect, warn only with the -w suffix compile option (or -w pedantic compile option).

Differences from QB

  • None

See also

  • String (data type)
  • Space

Examples

Print String( 4, 69 )         '' prints "EEEE"

Print String( 5, "Indeed" )   '' prints "IIIII"

End 0

Category: String Functions
Kind: function


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally