---
title: "Format ByteString specification"
canonical: "https://docs.cuesystem.com/space/CVCHELP/512328011/Format%20ByteString%20specification"
format: markdown
---
> Macro (toc)

---

# Boolean

It specifies the formatting of <u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u>. If the value of a parameter is True, a value of truetext will be used, a value of falsetext will be used otherwise. Values truetext and falsetext must be concluded between a pair of the apostrophe. These apostrophes are not part of truetext or falsetext. Values truetext and falsetext must not contain the apostrophe character. 

Values truetext and falsetext are optional from the right. If they are not specified, the texts "True" or "False" are used. 

#### Syntax 

```visualbasic
"{L['TrueText'['FalseText']]}"
```

Note: Using **L** and **l** (small letter) is equivalent. 

#### Example 

```visualbasic
Var dstbuf as ByteString[100] 

FormatByteString(dstbuf ,&S"It is {L 'Monday' 'Tuesday'} today.", True) 
DebugPrint(dstbuf) 
FormatByteString(dstbuf ,&S"It is {L 'Monday' 'Tuesday'} today.", False) 
DebugPrint(dstbuf)
```

It prints to the debug window: 

```visualbasic
It is Monday today. 
It is Tuesday today.
```

#### Example 

```visualbasic
Var Status As Boolean 
Var dstbuf as ByteString[100] 

Status := True 
FormatByteString(&S"It is {L}.", Status) 
DebugPrint(dstbuf) 
Status := False 
FormatByteString(&S"It is {L}.", Status) 
DebugPrint(dstbuf)
```

It prints to the debug window: 

```visualbasic
It is True. 
It is False. 
```

# Number

It specifies the formatting of <u>[Byte](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Byte)</u>, <u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> and <u>[Double](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Double)</u>. 

#### Syntax 

```visualbasic
&S"{N[SignSpecifier][Precision]}"
```

Note: Using **N** and **n** is equivalent. 

#### SignSpecifier 


|  |  |
| --- | --- |
| Values | Description |
| empty | For negative signed values appears "–", for positive does nappearars anything. |
| + | Sign appears always. |
| - | For negative signed values appears "–", for positive appears " " (space). |
| h | A hexadecimal format of a conversion is used. floatpartspecification must be empty. Lower characters "abcdef" are used. **This flag is ignored for Double type variable.** |
| H | A hexadecimal format of a conversion is used. floatpartspecification must be empty. Upper characters "ABCDEF" are used. **This flag is ignored for Double type variable.** |
| b | A binary format of a conversion is used. floatpartspecification must be empty. **This flag is ignored for Double type variable.** |

#### Example 

```visualbasic
Var DstBytStr As ByteString[100] 

FormatByteString(DstBytStr, &s"{n}", 123) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{n}", -123) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{n+}", 123) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{n+}", -123) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{n-}", 123) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{n-}", -123) 
DebugPrint(DstBytStr)
```

It prints to the debug window: 

```visualbasic
123 
-123 
+123 
-123 
 123 
-123
```

#### Example 

```visualbasic
Var DstBytStr As ByteString[100] 

FormatByteString(DstBytStr, &s"{nh}", 123) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{nh}", 12345678) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{nH}", 12345678) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{nb}", 123) 
DebugPrint(DstBytStr)
```

It prints to the debug window: 

```visualbasic
7b 
bc614e 
BC614E 
1111011
```

#### Precision 

```
[0][beforedotcount][floatpartspecification]
```

***0**** *

Zero character adds zeros from the left. 

***beforedotcount**** *

It is the minimum number of characters of the number to be formatted. It is an integral number. It must be greater than zero. 

#### Example 

```visualbasic
Var DstBytStr As ByteString[100] 

FormatByteString(DstBytStr, &s"{n}", 123) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{n4}", 123) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{n8}", 123) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{n04}", 123) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{n08}", 123) 
DebugPrint(DstBytStr)
```

It prints to the debug window: 

```visualbasic
123 
 123 
     123 
0123 
00000123
```

#### Example 

```visualbasic
Var DstBytStr As ByteString[100] 

FormatByteString(DstBytStr, &s"{nH}", 123) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{nH04}", 123) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{nH08}", 123) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{nb}", 123) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{nb010}", 123) 
DebugPrint(DstBytStr)
```

It prints to the debug window: 

```visualbasic
7B 
007B 
0000007B 
1111011 
0001111011
```

#### floatpartspecification 

|  |  |  |
| --- | --- | --- |
| Name | Parts/Values | Description |
| floatpartspecification | dotpart exppart |  |
| dotpart | empty | No effect. |
| **.**integralnumber | Number of decimal places to which the number is rounded. |
| exppart | empty | No effect. |
| e expspecification |  |
| expspecification | empty | No effect. |
| fillchar explen |  |
| explen | empty | No effect. |
| integralnumber |  |

#### Example 

```visualbasic
Var DstBytStr As ByteString[100] 

FormatByteString(DstBytStr, &s"{n}", 123.456) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{n.1}", 123.456) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{n.2}", 123.456) 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &s"{n.10}", 123.456) 
DebugPrint(DstBytStr)
```

It prints to the debug window: 

```visualbasic
123.456000 
123.5 
123.46 
123.4560000000
```

# Text

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

#### Syntax 

```visualbasic
"{[CharacterEncoding]T[Conversion][Justification]}"
```

Note: Using **T** and **t** is equivalent. 

#### Character encoding 

|  |  |
| --- | --- |
|  | Output format |
| None | ASCII encoding – only lower byte from text character is used |
| (ASCII) | ASCII encoding – only lower byte from text character is used |
| (UTF8) | Source text is converted to ByteString in UTF-8 encoding |

#### Character conversion 

|  |  |
| --- | --- |
| Character | Output format |
| none | No conversion. |
| "U" | To uppercase. |
| "L" | To lowercase. |

#### Justification 

For function ParseByteString is information about the length of a field. For function FormatByteString is used for alignment of a text in the box of a defined length. 

```visualbasic
[justifyspecification sizespecification]
```

|  |  |  |
| --- | --- | --- |
| Name | Parts/Values | Description |
| justifyspecification | jl | Left. |
| jc | Center. |
| jr | Right. |
| sizespecification | integralnumber |  |

#### Example 

```visualbasic
Var DstBytStr As ByteString[100] 

FormatByteString(DstBytStr, &S"It is {t} today.", "Monday") 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &S"It is {tu} today.", "Monday") 
DebugPrint(DstBytStr) 
FormatByteString(DstBytStr, &S"It is {tl} today.", "Monday") 
DebugPrint(DstBytStr)  
FormatByteString(DstBytStr,&S"{(UTF8)t}","ščřž") 
DebugPrintFormat(&S"{sh}", DstBytStr)  
Page Break
```

It prints to the debug window: 

```visualbasic
It is Monday today. 
It is MONDAY today. 
It is monday today. 
\C5\A1\C4\8D\C5\99\C5\BE
```

# ByteString

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

#### Syntax 

```visualbasic
&S"{S}"
```

Note: Using **S** and **s** is equivalent. 

#### Example 

```visualbasic
Var DstBytStr As ByteString[100] 

FormatByteString(DstBytStr, &s"abc{s}\07\08", &s"123\04\05\06\ff") 
DebugPrint(DstBytStr)
```

It prints to the debug window: 

```visualbasic
abc123\04\05\06\FF\07\08
```

#### Syntax 

```visualbasic
"{Sh}"
```

Note: Using **S** and **s** is equivalent. Using **H** and **h** is equivalent. 

#### Example 

```visualbasic
Var DstBytStr As ByteString[100] 

FormatByteString(DstBytStr, &s"abc{sh}\07\08", &s"123\04\05\06\ff") 
DebugPrint(DstBytStr)
```

It prints to the debug window: 

```
abc\31\32\33\04\05\06\ff\07\08
```

# Character {

Character **{** determines a parameter declaration. To print it, it must be double: **{{** (then it does not determine a parameter declaration). Character **}** is printed normally. 

- **{{** prints **{**
- **}** prints **}**


#### Example 

```

Var dst As ByteString[100]
FormatByteString(dst,&S"Have a {{nice} trip.")
DebugPrint(dst)
```

It prints to the debug window: 

```
Have a {nice} trip. 
```