[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'System' (#rtl)

# SetString

Set length of a string and copy buffer.

## Declaration

Source position: systemh.inc line 1175

`procedure SetString(`
`out S: AnsiString;`
`Buf: PAnsiChar;`
`Len: SizeInt`
`); procedure SetString(`
`out S: AnsiString;`
`Buf: PWideChar;`
`Len: SizeInt`
`); procedure SetString(`
`out S: Shortstring;`
`Buf: PChar;`
`Len: SizeInt`
`); procedure SetString(`
`out S: UnicodeString;`
`Buf: PUnicodeChar;`
`Len: SizeInt`
`); procedure SetString(`
`out S: UnicodeString;`
`Buf: PChar;`
`Len: SizeInt`
`); procedure SetString(`
`out S: WideString;`
`Buf: PWideChar;`
`Len: SizeInt`
`); procedure SetString(`
`out S: WideString;`
`Buf: PChar;`
`Len: SizeInt`
`);`

## Description

SetString sets the length of the string S to Len and if Buf is non-nil, copies Len characters from Buf into S. S can be an ansistring, a short string or a widestring. For ShortStrings, Len can maximally be 255.

## Errors

None.

## See also

SetLength |  | Set length of a string or dynamic array.

Documentation generated on: May 14 2021