<div class="meta" robots="noindex">

</div>

Method

# String.ToText

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2020r2. There is no replacement.

</div>

## Description

Converts the String to a Text value provided there is a valid encoding on the String.

## Notes

If the String does not have a valid encoding (such as it is Nil) then a Xojo.Core.BadDataException is raised. You can define an encoding for the String using `DefineEncoding</api/text/encoding_text/defineencoding>`.

## Compatibility

All project types on all supported operating systems.

## See also

`String</api/data_types/string>` parent class; `String</api/data_types/string>` data type
