Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Const
- AllSymbols:= '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
- Function ExtendedToOtherCC;
- Var
- Temp: LongInt;
- Res: String;
- Negative: Boolean;
- Begin
- Negative:= Source < 0;
- Res:= ''; Source:= Abs(Int(Source));
- While Source >= BaseOfCount Do Begin
- Temp:= Trunc(Source - Int(Source / BaseOfCount) * BaseOfCount);
- Source:= Int(Source / BaseOfCount);
- Res:= AllSymbols[Temp + 1] + Res;
- End;
- Temp:= Trunc(Source - Int(Source / BaseOfCount) * BaseOfCount);
- Res:= AllSymbols[Temp + 1] + Res;
- If Negative Then Res:= '-' + Res;
- ExtendedToOtherCC:= Res;
- End;
- Function OtherCCToExtended;
- Var
- P, Temp: Word;
- CurSymbols: String;
- OutPut, Count: Extended;
- Begin
- P:= Length(Number); OutPut:= 0; Count:= 1;
- CurSymbols:= UpperCase(Copy(AllSymbols, 1, BaseOfCount));
- While P >= 1 Do Begin
- For Temp:= 1 To BaseOfCount Do Begin
- If CurSymbols[Temp] = Number[P] Then Begin
- OutPut:= OutPut + Count * (Temp - 1);
- Count:= Count * BaseOfCount;
- Break;
- End;
- End;
- Dec(P);
- End;
- OtherCCToExtended:= OutPut;
- End;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement