UCharArrayToString

See Also: Array Functions, Array Variable Assignments, String Functions, Working with Arrays, StringToUCharArray, UCharArrayToString, UCharToWString, WStringToUCharArray

Purpose

Returns a DataFlex string which is a copy of the passed UChar array.

Return Type

String

Syntax

UCharArrayToString( {UCharArray} )

UCharArrayToString( {UCharArray}[, {size} ])

UCharArrayToString( {UCharArray}[, {size} [, {offset} ] )

Where:

What it Does

Examples

This sample copies all bytes from the UChar array uaMyString to the DataFlex string sValue, resulting in sValue containing the value "Testing".

Procedure Test

    UChar[] uaMyString

    String sValue

    

    Move (Ascii("T")) to uaMyString[0]

    Move (Ascii("e")) to uaMyString[1]

    Move (Ascii("s")) to uaMyString[2]

    Move (Ascii("t")) to uaMyString[3]

    Move (Ascii("i")) to uaMyString[4]

    Move (Ascii("n")) to uaMyString[5]

    Move (Ascii("g")) to uaMyString[6]

 

    Move (UCharArrayToString(uaMyString)) to sValue

End_Procedure

This sample copies the first 4 bytes from the UChar array uaMyString to the DataFlex string sValue, resulting in sValue containing the value "Test".

Procedure Test

    UChar[] uaMyString

    String sValue

    

    Move (Ascii("T")) to uaMyString[0]

    Move (Ascii("e")) to uaMyString[1]

    Move (Ascii("s")) to uaMyString[2]

    Move (Ascii("t")) to uaMyString[3]

    Move (Ascii("i")) to uaMyString[4]

    Move (Ascii("n")) to uaMyString[5]

    Move (Ascii("g")) to uaMyString[6]

 

    Move (UCharArrayToString(uaMyString, 4)) to sValue

End_Procedure

This sample copies 4 bytes from the UChar array uaMyString to the DataFlex string sValue, starting at array item 2, resulting in sValue containing the value "stin".

Procedure Test

    UChar[] uaMyString

    String sValue

    

    Move (Ascii("T")) to uaMyString[0]

    Move (Ascii("e")) to uaMyString[1]

    Move (Ascii("s")) to uaMyString[2]

    Move (Ascii("t")) to uaMyString[3]

    Move (Ascii("i")) to uaMyString[4]

    Move (Ascii("n")) to uaMyString[5]

    Move (Ascii("g")) to uaMyString[6]

 

    Move (UCharArrayToString(uaMyString, 4, 2)) to sValue

End_Procedure