EC_CopyAString

Works with: Euphoria version 4.0.3, 4.0.0 RC1 and later

This task copies a string. As it applies to euphoria, strings fit in sequences. A string is a group of human readable characters, as in ASCII or UTF format. This example declares the sequences on the same lines that it uses them.

Arrays in many languages are constrained to have a fixed number of elements, and those elements must all be of the same type. Euphoria eliminates both of those restrictions by defining all arrays (sequences) as a list of zero or more Euphoria objects whose element count can be changed at any time. When you retrieve a sequence element, it is not guaranteed to be of any type. You, as a programmer, need to check that the retrieved data is of the type you'd expect, Euphoria will not. The only thing it will check is whether an assignment is legal. For example, if you try to assign a sequence to an integer variable, Euphoria will complain at the time your code does the assignment.

sequence first = "ABC" --characters in double quotes are one of a few ways to define a 'string' in euphoria 
sequence newOne = first --newOne is made and the contents of sequence called first are copied into it. 
? first --shows this string in console ouput 
? newOne --shows that this is a copy of the other
Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu