当前位置: 技术问答>java相关
字符转换问题,高手请进,急救!!!!!!!!!!!
来源: 互联网 发布时间:2015-02-16
本文导语: function EncryptStr(SourceStr: string): string; var StrLen: Integer; TempStr: string; TempStr1: string; i: Integer; Byte1: Byte; begin TempStr := ''; TempStr1 := '01'; StrLen := Length(SourceStr); for i := 1 to StrLen do ...
function EncryptStr(SourceStr: string): string;
var
StrLen: Integer;
TempStr: string;
TempStr1: string;
i: Integer;
Byte1: Byte;
begin
TempStr := '';
TempStr1 := '01';
StrLen := Length(SourceStr);
for i := 1 to StrLen do
begin
Byte1 := Ord(SourceStr[i]) + 120;
TempStr1[1] := Chr(Byte1);
TempStr1[2] := Chr(Byte1 + 7);
TempStr := TempStr + TempStr1;
end;
EncryptStr := TempStr;
end;
如何做一个与之完全等效的java方法,由于java用的是unicode,急救!!!!!!!!!! ,给源码!!!!!!!!!!
var
StrLen: Integer;
TempStr: string;
TempStr1: string;
i: Integer;
Byte1: Byte;
begin
TempStr := '';
TempStr1 := '01';
StrLen := Length(SourceStr);
for i := 1 to StrLen do
begin
Byte1 := Ord(SourceStr[i]) + 120;
TempStr1[1] := Chr(Byte1);
TempStr1[2] := Chr(Byte1 + 7);
TempStr := TempStr + TempStr1;
end;
EncryptStr := TempStr;
end;
如何做一个与之完全等效的java方法,由于java用的是unicode,急救!!!!!!!!!! ,给源码!!!!!!!!!!
|
public static String encode(String src)
{
byte[] ch = src.getBytes();
byte[] result = new byte[ch.length * 2];
for(int i = 0; i
{
byte[] ch = src.getBytes();
byte[] result = new byte[ch.length * 2];
for(int i = 0; i