---
title: "Text"
canonical: "https://docs.cuesystem.com/space/CVCHELP/512327836/Text"
format: markdown
---
> Macro (toc)

---

# CompareText

This function compares **text1** and **text2** and returns a comparison result. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[67](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#67)</u>, <u>[68](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#68)</u>. 

#### Syntax 

```visualbasic
Function CompareText( 
  text1 As Text, 
  text2 As Text, 
  Optional flags As Long := _COMPARE_CASESENSITIVE) 
As Long
```

#### Parameters 

text1 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the text1 to compare. 

text2 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is text2 to compare. 

flags 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> Optional, defaults to _COMPARE_CASESENSITIVE. It is the type of comparison. Predefined constants for parameter flags are as follows: 

|  |  |
| --- | --- |
| Name | Description |
| _COMPARE_CASESENSITIVE | Case sensitive comparison. |
| _COMPARE_CASEINSENSITIVE | Case insensitive comparison. |

#### Return value 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is a comparison result. Predefined result constants are as follows: 

|  |  |  |
| --- | --- | --- |
| Name | Value | Description |
| _COMPARE_ERROR | 0 | Some error occurs. The error can be tested using the **GetLastError **function. |
| _COMPARE_LESS_THAN | 1 | text1 is less than text2. |
| _COMPARE_EQUAL | 2 | text1 identical to text2. |
| _COMPARE_GREATER_THAN | 3 | text1 is greater than text2. |

# ConcatenateText

This function concatenates texts placed in **ParamArray** and places the result in the **destinationtext**. The function returns **true** on success. If an error occurs, then **destinationtext** is filled by the maximum possible characters and the function returns **false**. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[55](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#55)</u>, <u>[56](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#56)</u>, <u>[57](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#57)</u>, <u>[58](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#58)</u>. 

#### Syntax 

```visualbasic
Function ConcatenateText( 
  ByRef destinationtext As Text, 
  ParamArray) 
As Boolean
```

#### Parameters 

destinationtext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the concatenated result. 

ParamArray 

<u>[ParamArray](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/509149361)</u> It is the array of texts to concatenate. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. The function GetLastError returns the error number. 

# FormatText

This function creates a text from parameters listed in ParamArray using the formatting rules **formattext** and places it to the **destinationtext**. The function is used for more complex transfer of numbers to a text and its integration into the target text. The function is also suitable for creating chains for text-based communication protocols. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[2](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#2)</u>, <u>[3](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#3)</u>, <u>[4](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#4)</u>, <u>[5](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#5)</u>, <u>[6](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#6)</u>, <u>[8](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#8)</u>, <u>[9](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#9)</u>, <u>[10](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#10)</u>, <u>[11](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#11)</u>, <u>[12](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#12)</u>, <u>[13](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#13)</u>, <u>[14](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#14)</u>, <u>[15](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#15)</u>, <u>[32](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#32)</u>, <u>[33](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#33)</u>, <u>[34](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#34)</u>, <u>[35](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#35)</u>, <u>[36](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#36)</u>, <u>[37](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#37)</u>, <u>[38](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#38)</u>, <u>[39](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#39)</u>. 

#### Syntax 

```visualbasic
Function FormatText( 
  ByRef destinationtext As Text, 
  formattext As Text, 
  ParamArray) 
As Boolean
```

#### Parameters 

destinationtext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the destination text to which the result of the format will be stored. 

formattext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the formatted text, which sets rules on the format, which will be applied to the variable parameters. See the [Format Text specification](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/518881281). 

ParamArray 

<u>[ParamArray](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/509149361)</u> It contains parameters to be formatted (converted to text) and inserted into the destinationtext. These values can be of different types: Text, ByteString, Boolean, Byte, Char, Long, Double, and Time. Each type can be formatted in different ways. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. The function GetLastError returns the error number. 

# GetSubTextPosition

This function returns a Long value specifying the position of the first occurrence of **subtext** (after optional **fromposition**) within **sourcetext**. If the searched text is not found or some error occurs, the function returns zero. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[63](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#63)</u>, <u>[64](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#64)</u>, <u>[65](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#65)</u>, <u>[66](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#66)</u>. 

#### Syntax 

```visualbasic
Function GetSubtextPosition( 
  sourcetext As Text, 
  subtext As Text, 
  Optional fromposition As Long := 1, 
  Optional casesensitive As Boolean := True) 
As Long
```

#### Parameters 

sourcetext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the source text being searched. 

subtext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the text sought. 

fromposition 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> Optional, defaults to 1. It is the starting position for each search. If omitted, the search begins at the first character position. 

casesensitive 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> Optional, defaults to True, the subtext is searched case sensitive. If it is entered as False, the subtext is searched case insensitive. 

#### Return value* *

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is the **subtext** position within the **sourcetext**. It is zero if the searched text is not found or some error occurs. 

# GetTextActualLength

This function returns a value of the current length of a **sourcetext **variable. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[53](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#53)</u>. 

#### Syntax 

```visualbasic
Function GetTextActualLength(sourcetext As Text) As Long
```

#### Parameters 

sourcetext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the text. 

#### Return value 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is a length of a **sourcetext **variable. 

# GetTextDeclaredLength

This function returns a value of the declared length of the **sourcetext** variable. This is helpful for programmers to determine at runtime the length of variables. In addition, it also allows the programmer to build runtime logic so they won’t accidentally try to put too large of a text into the variable. It returns zero if an error occurs. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[54](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#54)</u>. 

#### Syntax 

```visualbasic
Function GetTextDeclaredLength(sourcetext As Text) As Long
```

#### Parameters 

sourcetext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the text. 

#### Return value 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is a length of a **sourcetext **variable. It is zero if an error occurs. 

# GetTextLanguageVersion

This function gets the text in the requested language from resource text and copies it to the **destinationtext**. 

#### Syntax 

```visualbasic
Function GetTextLanguageVersion( 
  resourcetext As AddressOf Text, 
  languageid As Long, 
  ByRef destinationtext As Text) 
As Boolean
```

#### Parameters 

resourcetext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is a text variable from text resources. 

languageid 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is required laguageid. 

destinationtext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the destination text.  

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if resource text does not exist in the requested languageid. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[242](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#242)</u>, <u>[243](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#243)</u>. 

```visualbasic
Var dst As Text[100] 

GetTextFromResources(MyCommon.txtExample, _LANGUAGE_GERMAN_GERMANY, dst)
```

# GetTextLeft

This function takes the left part of the **sourcetext** with a specified **length** and copies it to the **destinationtext**. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[43](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#43)</u>, <u>[45](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#45)</u>, <u>[46](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#46)</u>, <u>[47](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#47)</u>. 

#### Syntax 

```visualbasic
Function GetTextLeft( 
  sourcetext As Text, 
  length As Long, 
  ByRef destinationtext As Text) 
As Boolean
```

#### Parameters 

sourcetext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the source text. 

length 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is the desired length starting from the left position. It must be greater than or equal to 0. 

destinationtext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the destination text. If it is shorter than a required part of sourcetext, then destinationtext is filled by the maximum possible characters and the function returns false. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. The function GetLastError returns the error number. 

# GetTextMiddle

This function takes the middle part of the **sourcetext** beginning on **startposition **with a specified **length **and copies it to the **destinationtext**. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[43](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#43)</u>, <u>[44](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#44)</u>, <u>[45](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#45)</u>, <u>[46](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#46)</u>, <u>[47](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#47)</u>, <u>[48](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#48)</u>, <u>[49](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#49)</u>. 

#### Syntax 

```visualbasic
Function GetTextMiddle( 
  sourcetext As Text, 
  startposition As Long, 
  length As Long, 
  ByRef destinationtext As Text) 
As Boolean
```

#### Parameters 

sourcetext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the source text. 

startposition 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is the starting position within the text. It must be greater than 1. 

length 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is the desired length from the starting position. It must be greater than or equal to 0. 

destinationtext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the destination text. If it is shorter than a required part of sourcetext, then destinationtext is filled by the maximum possible characters and the function returns false. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. The function GetLastError returns the error number. 

# GetTextRight

This function takes the right part of the **sourcetext** with a specified **length** and copies it to the **destinationtext**. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[43](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#43)</u>, <u>[45](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#45)</u>, <u>[46](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#46)</u>, <u>[47](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#47)</u>. 

#### Syntax 

```visualbasic
Function GetTextRight( 
  sourcetext As Text, 
  length As Long, 
  ByRef destinationtext As Text) 
As Boolean
```

#### Parameters 

sourcetext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the source text. 

length 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is the desired length starting from the right position. It must be greater than or equal to 0. 

destinationtext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the destination text. If it is shorter than a required part of sourcetext, then destinationtext is filled by the maximum possible characters and the function returns false. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. The function GetLastError returns the error number. 

# NumberToText

This function converts one number into the **destinationtext**. Function expected one number (byte, char, long, double, or time) as **ParamArray**. The number is converted in the default format. If you need to convert a number to other formats, it is necessary to use the command **FormatText**. 

#### The default format of conversion numeric types to Text 

|  |  |
| --- | --- |
| Type | Description |
| Byte | Integral number without a sign. For example "0", "10", "255". |
| Char | One char. For example "a", "A", Integral |
| Long | Integral number with a sign in case of a negative number. For example "0", "100", "-99". |
| Double | Floating point number with a sign in case of s negative number. A full number of decimal places, if the number is not integral. For example "10", "100.1", "-999.99" |

#### Syntax 

```visualbasic
Function NumberToText( 
  ByRef destinationtext As Text, 
  ParamArray[1]) 
As Boolean
```

#### Parameters 

destinationtext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the destination. 

ParamArray 

<u>[ParamArray](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/509149361)</u> It is the number to convert. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. The function GetLastError returns the error number. 

# ParseText

This function is designed to convert a text to a number or more numbers. You can specify the text format and pass ByRef ParamArray the right types of parameters to which stores analysis results. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[2](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#2)</u>, <u>[3](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#3)</u>, <u>[4](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#4)</u>, <u>[5](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#5)</u>, <u>[6](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#6)</u>, <u>[8](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#8)</u>, <u>[9](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#9)</u>, <u>[10](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#10)</u>, <u>[11](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#11)</u>, <u>[12](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#12)</u>, <u>[13](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#13)</u>, <u>[14](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#14)</u>, <u>[15](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#15)</u>, <u>[16](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#16)</u>, <u>[17](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#17)</u>, <u>[18](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#18)</u>, <u>[19](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#19)</u>, <u>[20](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#20)</u>, <u>[21](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#21)</u>, <u>[22](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#22)</u>, <u>[23](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#23)</u>, <u>[24](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#24)</u>. 

#### Syntax 

```visualbasic
Function ParseText( 
  sourcetext As Text, 
  formattext As Text, 
  ByRef ParamArray) 
As Boolean
```

#### Parameters 

sourcetext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the source text that must meet the formatting rule format. 

formattext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the description of the format of the source text. It contains formatting items that can be interspersed with free text. If there is free text, then the position of the source text must be the same free text, otherwise indicating disagreement with the source data format. 

ParamArray 

<u>[ParamArray](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/509149361)</u> They are addresses of target variables, which save the result of the text values. If we are not interested in some values, you can then transmit the position as a parameter Nothing. It is not considered an error, only the underlying value is not saved. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. The function GetLastError returns the error number. 

#### Formatting code of the parameter format 

A format code contains a list of variable formats. Formats are placed in curly brackets. See the <u>[Parse Text specification](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/763527188)</u>. The various formats can be interspersed with free text. 

#### Recognition of grammar for a number 

This format represents the number, if the endpoint of a double or flags format is a double, then recognizes a floating point number or floating point number in exponential notation. Otherwise recognizes an integral number. Gaps between the number and sign a number are ignored. See the following grammar. 

#### Recognition of grammar for an integral number 

```visualbasic
LongNumber := [whitespace][sign][whitespace]lineofdigits
```

```visualbasic
Sign := + | - | empty
```

The format can specify what type of numbers should be recognized. If the format is used modifier H, it is enumerated as a hexadecimal number. For modifier B it is enumerated as a binary number. Otherwise, it is enumerated as a decimal number. It is important to distinguish between the sign in the source text (this also applies to binary and hexadecimal numbers) and a modifier/sign regulation in the format - it affects only how the detection of numbers (binary/hexadecimal/decimal). 

#### Recognition of grammar for floating point number 

```
DoubleNumber := [whitespace][sign][whitespace]fixpart[dot dotpart[E sign exponent]]
```

#### Limiting the width of each field for each of the source text 

If each number is placed next to each other, it is necessary to specify the width of each field. This is done using the modifier alignment (justification). Only the value of the width of the field from this modifier is used. Recognition is then limited to this width. 

```visualbasic
Var Num1 As Long 
Var Num2 As Long 
Var Num3 As Long 

ParseText("123456789", "{nj2}{nj3}{nj4}", Num1, Num2, Num3) 
// Num1 = 12, Num2 = 345, Num3 = 6789
```

```visualbasic
Var Text1 As Text[50] 
Var Text2 As Text[50] 
Var Num1 As Long 
Var Num2 As Long 

ParseText("Hello123Boyff", "{tj5}{nj3}{tj3}{nhj2}", Text1, Num1, Text2, Num2) 
// Text1 = "Hello", Num1 = 123, Text2 = "Boy", Num2 = 255 (= &Hff)
```

#### Recognition of grammar for text 

If not specified the format of the text width, is taken as the width of the declared length of the text. 

# SetTextActualLength

This function sets the current length of **destinationtext** according to the parameter **length**. 

The function must be used before the variable length is changed by direct access to the variable's <u>[Chars](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Char)</u>: 

```visualbasic
Var t As Text[100] := "Hello" // actual length = 5 

SetTextActualLength(t, 6) 
// increase actual length to 6 to add one character at the end 

t[6] := '!' // direct access 
// t contains "Hello!"
```

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[50](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#50)</u>, <u>[51](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#51)</u>, <u>[52](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#52)</u>. 

#### Syntax 

```visualbasic
Function SetTextActualLength( 
  ByRef destinationtext As Text, 
  length As Long) 
As Boolean
```

#### Parameters 

destinationtext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the destination text. 

length 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is the new length. It must be in the range from 0 to the declared length of the text. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. The function GetLastError returns the error number. 

# TextToByteString

This function converts a source text **srctext** into a destination **dstbytestring**. The conversion is to: ASCII, UTF8 or UTF16. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[69](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#69)</u>, <u>[70](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#70)</u>, <u>[71](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#71)</u>, <u>[72](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#72)</u>. 

#### Syntax 

```visualbasic
Function TextToByteString( 
  srctext As Text, 
  ByRef dstbytestring As ByteString, 
  conversiontype As Long) 
As Boolean
```

#### Parameters 

srctext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the source text. 

dstbytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the destination ByteString. 

conversiontype 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is the type of conversion. Predefined constants for parameter conversiontype are as follows: 

|  |  |
| --- | --- |
| Name | Description |
| _TEXT_TO_ASCII | Conversion to ASCII. |
| _TEXT_TO_UTF8 | Conversion to UTF8. |
| _TEXT_TO_UTF16LE | Conversion to UTF16 little-endian. |

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. The function GetLastError returns the error number. 

# TextToLowercase

This function saves a lowercase representation of a **sourcetext** to the **destinationtext**. Only uppercase letters are converted to lowercase. All lowercase letters and nonletter characters remain unchanged. 

#### Syntax 

```visualbasic
Function TextToLowercase( 
  sourcetext As Text, 
  ByRef destinationtext As Text) 
As Boolean
```

#### Parameters 

sourcetext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the source text. 

destinationtext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the destination text. If it is shorter than sourcetext, then destinationtext is filled by the maximum possible characters and the function returns false. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. The function GetLastError returns the error number. 

# TextToUppercase

This function saves an uppercase representation of a **sourcetext** to the **destinationtext**. Only lowercase letters are converted to uppercase. All uppercase letters and nonletter characters remain unchanged. 

#### Syntax 

```visualbasic
Function TextToUppercase( 
  sourcetext As Text, 
  ByRef destinationtext As Text) 
As Boolean
```

#### Parameters 

sourcetext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the source text. 

destinationtext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the destination text. If it is shorter than sourcetext, then destinationtext is filled by the maximum possible characters and the function returns false. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. The function GetLastError returns the error number. 

# TrimText

This function saves a **sourcetext **without leading and trailing characters specified in** trimchars** into the **destinationtext**. If the optional **trimchars** parameter is not used, the default value (space character) is used for trimming. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[59](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#59)</u>, <u>[60](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#60)</u>, <u>[61](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#61)</u>, <u>[62](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#62)</u>. 

#### Syntax 

```visualbasic
Function TrimText( 
  sourcetext As Text, 
  ByRef destinationtext As Text, 
  Optional trimchars As Text := " ") 
As Boolean
```

#### Parameters 

sourcetext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the source text. 

destinationtext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the destination text. If it is shorter than sourcetext, then destinationtext is filled by the maximum possible characters and the function returns false. 

trimchars 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> Optional, defaults to " ". It specifies the trim characters. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. The function GetLastError returns the error number. 

# TrimTextLeft

This function saves a **sourcetext **without leading characters specified in** trimchars** into the **destinationtext**. If the optional **trimchars** parameter is not used, the default value (space character) is used for trimming. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[59](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#59)</u>, <u>[60](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#60)</u>, <u>[61](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#61)</u>, <u>[62](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#62)</u>. 

#### Syntax* *

```visualbasic
Function TrimTextLeft( 
  sourcetext As Text, 
  ByRef destinationtext As Text, 
  Optional trimchars As Text := " ") 
As Boolean
```

#### Parameters 

sourcetext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the source text. 

destinationtext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the destination text. If it is shorter than sourcetext, then destinationtext is filled by the maximum possible characters and the function returns false. 

trimchars 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> Optional, defaults to " ". It specifies the trim characters. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. The function GetLastError returns the error number. 

# TrimTextRight

This function saves a **sourcetext **without trailing characters specified in** trimchars** into the **destinationtext**. If the optional **trimchars** parameter is not used, the default value (space character) is used for trimming. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[59](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#59)</u>, <u>[60](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#60)</u>, <u>[61](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#61)</u>, <u>[62](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#62)</u>. 

#### Syntax* *

```visualbasic
Function TrimTextRight( 
  sourcetext As Text, 
  ByRef destinationtext As Text, 
  Optional trimchars As Text := " ") 
As Boolean
```

#### Parameters 

sourcetext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the source text. 

destinationtext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the destination text. If it is shorter than sourcetext, then destinationtext is filled by the maximum possible characters and the function returns false. 

trimchars 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> Optional, defaults to " ". It specifies the trim characters. 

#### Return value* *

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. The function GetLastError returns the error number.