{{fbdoc item="title" value="Operator [] (String index)"}}----
Returns a reference to a character in a string

{{fbdoc item="syntax"}}##
	[[KeyPgDeclare declare]] [[KeyPgOperator operator]] **[]** ( [[KeyPgByref byref]] //lhs// [[KeyPgAs as]] [[KeyPgString string]], [[KeyPgByref byref]] //rhs// [[KeyPgAs as]] [[KeyPgInteger integer]] ) [[KeyPgByrefFunction byref]] [[KeyPgAs as]] [[KeyPgUbyte ubyte]]
	[[KeyPgDeclare declare]] [[KeyPgOperator operator]] **[]** ( [[KeyPgByref byref]] //lhs// [[KeyPgAs as]] [[KeyPgZstring zstring]], [[KeyPgByref byref]] //rhs// [[KeyPgAs as]] [[KeyPgInteger integer]] ) [[KeyPgByrefFunction byref]] [[KeyPgAs as]] [[KeyPgUbyte ubyte]]
	[[KeyPgDeclare declare]] [[KeyPgOperator operator]] **[]** ( [[KeyPgByref byref]] //lhs// [[KeyPgAs as]] [[KeyPgWstring wstring]], [[KeyPgByref byref]] //rhs// [[KeyPgAs as]] [[KeyPgInteger integer]] ) [[KeyPgByrefFunction byref]] [[KeyPgAs as]] //T//
##

{{fbdoc item="usage"}}##
	//result// = //lhs// **[** //rhs// **]**
##
{{fbdoc item="param"}}
	##//lhs//##
		The string (a string reference, not a string returned as local copy).
	##//rhs//##
		A zero-based offset from the first character.
	##//T//##
		The wide-character type (varies per platform).

{{fbdoc item="desc"}}
	This operator returns a reference to a specific character in a string:
		- This operator must not be used in case of empty string because reference is undefined (inducing runtime error).
		- Otherwise, the user must ensure that the index does not exceed the range "[0, ##[[KeyPgLen Len]](//lhs//) - 1##]". Outside this range, results are undefined.

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/operator/stringindex.bas"}}%%(freebasic)
dim a as string = "Hello, world!"
dim i as integer

for i = 0 to len(a) - 1
	print chr(a[i]) & " ";
next i
print
%%

Will print
%%
H e l l o ,   w o r l d ! 
%%

{{fbdoc item="diff"}}
	- New to ""FreeBASIC""

{{fbdoc item="see"}}
	- [[CatPgOpString String Operators]]

{{fbdoc item="back" value="CatPgOpIndexing|Indexing Operators"}}{{fbdoc item="back" value="CatPgOperators|Operators"}}