String Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > String commands > !STR.- String Command >

String Operations

STR.MIME TO TEXT

Previous Top Next


MiniRobotLanguage (MRL)

 

STR.MIME TO TEXT

String commands

 

 

Intention

 

To transfer binary data in written form, all "non-printable characters" like ASCII 12,13 and others need to be encoded in printable Form.

For this generally the MIME-Format can be used. The MIME-Format is also called "BASE 64" Format.

STR.MIME TO TEXT will convert the MIME/BASE64 data that is contained in a variable, back to the original-Format. The result will be in the same variable or in a Target variable if given.

 

The command itself looks like this:

' $$SRC - Binary or Text-Data to convert to MIME

' $$TAR - MIME-Format Result

STR.MIME TO TEXT|$$SRC|$$TAR

 

The Result looks somehow like you see below.

Its a Screenshot from the Examples below (see Examples-Section).

 

graphic

 

As you can see the MIME encoded Binary is 360 bytes long, while the original size was 270 bytes. That is generally 134% the size of the original size.

 

If the MIME-Text contains linefeeds ($crlf$), these will be ignored.

 

graphic

 

 

This is the revers command to STR.TEXT TO MIME.

 

 

 

Syntax

 

STR.MIME TO TEXT|P1[|P2]

 

 

Parameter Explanation

 

P1 - source variable. If P2 is missing then its also the destination variable

 

P2 - (optional) destination variable. If omitted the result is placed in the variable in P1.

 

 

 

Example

 

'*************************************

' STR.MIME TO TEXT and

' STR.TEXT TO MIME

' using one Input-Output-Variable

'*************************************

$$SRC=What happens under BASE64 with the + and / Characters?

$$SRC=$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC

LEN.$$SRC|$$LEN

PRT.($$LEN)->$$SRC

STR.TEXT TO MIME|$$SRC

LEN.$$SRC|$$LEN

PRT.($$LEN)->$$SRC

STR.MIME TO TEXT|$$SRC

LEN.$$SRC|$$LEN

PRT.($$LEN)->$$SRC

 

$$SRC=What happens under BASE64 with the + and / Characters?

$$SRC=$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC

LEN.$$SRC|$$LEN

PRT.($$LEN)->$$SRC

STR.TEXT TO MIME|$$SRC||64

LEN.$$SRC|$$LEN

PRT.($$LEN)->$$SRC

STR.MIME TO TEXT|$$SRC

LEN.$$SRC|$$LEN

PRT.($$LEN)->$$SRC

 

MBX.It works!

ENR.

 

'*************************************

' STR.MIME TO TEXT and

' STR.TEXT TO MIME

' with a 40 Characters per Line Output

'*************************************

$$SRC=What happens under BASE64 with the + and / Characters?

$$SRC=$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC

STR.TEXT TO MIME|$$SRC|$$ERG|40

LEN.$$ERG|$$LEN

PRT.($$LEN)->$$ERG

$$SRC=$$ERG

STR.MIME TO TEXT|$$SRC|$$ERG

LEN.$$ERG|$$LEN

PRT.($$LEN)->$$ERG

MBX.It works!

ENR.

 

 

'*************************************

' STR.MIME TO TEXT and

' STR.TEXT TO MIME

' using one Variable only

' with a 40 Characters per Line Output

'*************************************

'

$$SRC=What happens under BASE64 with the + and / Characters?

$$SRC=$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC$$SRC

LEN.$$SRC|$$LEN

PRT.($$LEN)->$$SRC

STR.TEXT TO MIME|$$SRC

LEN.$$SRC|$$LEN

PRT.($$LEN)->$$SRC

STR.MIME TO TEXT|$$SRC

LEN.$$SRC|$$LEN

PRT.($$LEN)->$$SRC

MBX.It works!

 

 

 

 

Remarks

 

-

 

 

 

Limitations:

 

-

 

 

See also:

 

    1.5.2 Working with Text-Strings

    STR.TEXT TO MIME

    STR.TO BASE64 URL

    STR.FROM BASE64 URL

    Variables with Inline Data

    STR.GENERATE - Mode

    GEC. - Get Encryption

    GMD. - Get Message Digest

    SHA. - Safer Hash Algo

    VAR. - Variable Set Value/Clear

    VAS. - Variable with String

    RPL. - RePLace in String

    IVS. / NVS. - If-Variable-String

    GSS. - GetSplitString

    GFS. - Get-Filtered-String

    GES. - Get-Extracted-String

    SBD. - String between Delimiter

    SBM. - String between Delimiter-Multiple

    FEM. - For Each Member

    LEN. - Length-of-String