送给爱解密的朋友!根据当前字符串,生成下一个字符串的东东 !例如:A349 就生成A35A(10分)

  • 主题发起人 主题发起人 13708782004
  • 开始时间 开始时间
1

13708782004

Unregistered / Unconfirmed
GUEST, unregistred user!
unit PTGetOrderNextString;
interface
USES CLASSES,SysUtils,StrUtils;
type
TGetOrderNextString = class
private
r: string;
l_char: tstrings;
function GetNextChar(var s: string): boolean;
function GetNextString(s: string): string;
public
function GetRightNextstring(CurrentS: string): string;
constructor Create;
//构造函数
destructor DESTROY;
override;
//析构函数
end;

VAR a: TGetOrderNextString;
implementation

constructor TGetOrderNextString.Create;
var i: integer;
begin
l_char := tstringlist.Create;
for i := 65 to 65 + 25do
begin
l_char.Add(char(i));
end;

l_char.Add('_');
for i := 0 to 9do
begin
l_char.Add(inttostr(i));
end;
end;

destructor TGetOrderNextString.DESTROY;
begin
l_char.Free;
end;

function TGetOrderNextString.GetNextChar(var s: string): boolean;
var i: integer;
begin
i := l_char.IndexOf(s);
if i = l_char.Count - 1 then
begin
s := l_char.Strings[0];
result := false;
end
else
begin
s := l_char.Strings[i + 1];
result := true;
end;

end;

function TGetOrderNextString.GetNextString(s: string): string;
var i: integer;
ts: string;
begin
i := length(s);
TS := RIGHTSTR(s, 1);
Result := COPY(S, 1, i - 1);
if GetNextChar(TS) then
begin
R := RESULT + TS + R;
// //上次R 要附上
exit;
end
else
begin
R := R + TS;
//上次r 要附上本次ts
GetNextString(copy(s, 1, i - 1));
end;
end;


function TGetOrderNextString.GetRightNextstring(CurrentS: string): string;
begin
result := '';
while 1 > 0do
begin
r := '';
GetNextString(CurrentS);
if (pos('__', r) = 0) and (rightstr(r, 1) <> '_') and (leftstr(r, 1) <> '_') then
begin
result := r;
exit;
end;
CurrentS := r;
end;
end;
end.

//----欢迎和qq:42872272联系
 

Similar threads

I
回复
0
查看
587
import
I
I
回复
0
查看
657
import
I
I
回复
0
查看
698
import
I
后退
顶部