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

# TStringStream.Create

Creates a new stringstream and sets its initial content.

## Declaration

Source position: classesh.inc line 1096

`public constructor TStringStream.Create(`
`const ABytes: TBytes`
`); override; overload; constructor TStringStream.Create(`
`const AString: string = ''`
`); overload; constructor TStringStream.Create(`
`const AString: string;`
`AEncoding: TEncoding;`
`AOwnsEncoding: Boolean = True`
`); overload; constructor TStringStream.Create(`
`const AString: string;`
`ACodePage: Integer`
`); overload; constructor TStringStream.Create(`
`const AString: UnicodeString`
`); overload; constructor TStringStream.Create(`
`const AString: UnicodeString;`
`AEncoding: TEncoding;`
`AOwnsEncoding: Boolean = True`
`); overload; constructor TStringStream.Create(`
`const AString: UnicodeString;`
`ACodePage: Integer`
`); overload;`

## Description

Create creates a new TStringStream instance and sets its initial content to Astring. The position is still 0 but the size of the stream will equal the length of the string.

The Encoding argument specifies the codepage with which the bytes in the string will be interpreted. If it is not specified (or Nil) the system default encoding will be used. The correct encoding can be detected from the string by using the TStringStream.CreateRaw constructor.

## See also

TStringStream.DataString |  | Contains the contents of the stream in string form
TStringStream.UnicodeDataString |  | Datastring as unicode string
TStringStream.Encoding |  | Encoding of the string with the data
TStringStream.CreateRaw |  | Create stringstream using codepage of string

Documentation generated on: May 14 2021