Thursday, January 14, 2016

How You Can Encode And Decode Text

Hi all,
Today I posted how you can Encode And Decode Text.


//<<----------------Encoding Text--------------------->>
//------Define parameter-------->>
Var Name DataType Subtype Length
No string Text 50
//<<------------END----------------

//------Define Return Value-------->>
Name Pass
Return Type Text
Length 50
//<<------------END----------------

//------Define Variables-------->>
Name DataType Subtype Length
Ch Char
i Integer
//<<------------END----------------
//------Define Functions-------------->>
LOCAL EncodeTxt(string : Text[50]) Pass : Text[50]
//--------------START----------------->>
FOR i := 1 TO STRLEN(string) DO
BEGIN
  Ch := string[i];
  IF (Ch < 32) OR ((Ch > 127) AND (Ch < 192)) THEN
    ERROR('its not an alphanumeric.');
  Pass[i] := 255-Ch;
END;
EXIT(Pass);
//<<----------------END-------------------


//<<----------------Decoding Text--------------------->>
//------Define parameter-------->>
Var Name DataType Subtype Length
No string Text 50
//<<------------END----------------

//------Define Return Value-------->>
Name Pass
Return Type Text
Length 50
//<<------------END----------------

//------Define Variables---------->>
Name DataType Subtype Length
Ch Char
i Integer
//<<------------END----------------
//------Define Functions-------------->>
LOCAL DecodeTxt(string : Text[50]) Pass : Text[50]
FOR i := 1 TO STRLEN(String) DO
BEGIN
  Ch := String[i];
  Pass[i] := 255-Ch;
END;
EXIT(Pass);
//<<----------------END-------------------



Thanks & Best Wishes
Binesh Singh Rajput
(MCP, MS, MCTS)

No comments:

Post a Comment

Popular Posts