Hi to all
This plugin can convert string to number or number to string
For example:
Download link:
http://www.mediafire.com/download/6g5cj ... Coding.zip
Source code of Coding Action Plugin:
This plugin can convert string to number or number to string
For example:
result = Coding.Convert("AMS", true);
--return "65.77.83"
result = Coding.Convert("65.77.83", false);
--return "AMS"
Download link:
http://www.mediafire.com/download/6g5cj ... Coding.zip
Source code of Coding Action Plugin:
function Coding.Convert(A, B)
Code = "";
A = tostring(A);
if (B == true) then
Length = String.Length(A);
for X = 1, Length do
SM = String.Mid(A, X, 1);
SA = String.Asc(SM);
if (Code == "") then
Code = SA;
else
Code = Code.."."..SA;
end
end
return Code;
else
Decode = "";
CodingC = Coding.Count(A, ".");
if (CodingC == 0) then
SC = String.Char(A);
return SC;
end
CodingC = Coding.Count(A, ".");
for X = 1, CodingC do
CodingP = Coding.Part(A, ".", X);
SC = String.Char(CodingP);
if (Decode == "") then
Decode = SC;
else
Decode = Decode..""..SC;
end
end
return Decode;
end
end
function Coding.Count(A, B)
LoopCount = 0;
SF = 0;
SplitterPlace = {};
if (B == "") then
return 0;
end
Length = String.Length(A);
for X = 1, Length do
SF = String.Find(A, B, SF+1, true);
if (SF == -1) then
break;
else
LoopCount = LoopCount+1;
Table.Insert(SplitterPlace, LoopCount, SF);
end
end
if (#SplitterPlace == 0) then
return 0;
end
return #SplitterPlace+1;
end
function Coding.Part(A, B, C)
C = tonumber(C);
LoopCount = 0;
SF = 0;
SplitterPlace = {0};
if (B == "") then
return nil;
end
Length = String.Length(A);
for X = 1, Length do
SF = String.Find(A, B, SF+1, true);
if (SF == -1) then
break;
else
LoopCount = LoopCount+1;
Table.Insert(SplitterPlace, LoopCount, SF);
end
end
if (#SplitterPlace == 1 or C <= 0 or C > #SplitterPlace) then
return nil;
end
if (C == 1) then
CharStart = 1;
NumChar = SplitterPlace[C]-1;
elseif (C == #SplitterPlace) then
CharStart = SplitterPlace[C-1]+1;
NumChar = Length-(SplitterPlace[C-1]);
else
CharStart = SplitterPlace[C-1]+1;
NumChar = SplitterPlace[C]-(SplitterPlace[C-1]+1);
end
SM = String.Mid(A, CharStart, NumChar);
return SM;
end