English
Source / code snippets

Base arbitrary Konvertieren number

 

Jac
de
Lad
Converts a Dezimalzahl into other numerative (similar Hex$, Oct$ and so), only that The Base spare wählbar is (goes To 36, to Hexidezimal go simply The restlichen letters the Alphabets uses). and under The Umkehrfunktion.

in a whether someone sometime of it benefit may have and becomes...alas Yes, and one can The characters naturally discretionary strain or Change...!
CompileMarkSeparation
proc ConvertBase

    Parameters x&,b&
    declare y$,z&,l%
    l%=Int(Ln(x&)/Ln(b&))

    whileloop l%,0,-1

        z&=x&&^&Loop

        If GT(z&,0)

            y$=y$+Mid$("123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",z&,1)
            Sub x&,z&*b&^&Loop

        else

            case Neq$("",y$):y$=y$+"0"

        endif

    wend

    Return y$

endproc

proc ConvertToDec

    Parameters y$,b&
    declare l%,e&
    l%=Len(y$)

    whileloop 1,l%

        e&=e&+Instr(Mid$(y$,&Loop,1),"123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")*b&^(l%-&Loop)

    wend

    Return e&

endproc


Jac

PS: me would time interested, what your of it hold. but Please aboveboard Anworten, sincere said have myself for really no sinnvolle application...
 
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
01/24/06  
 




Timotheus
Erweitere your Proceduren simply on any 256 Chrs the computer-Alphabets. the minimizes The Speicherung of numbers for a beträchtliches. I use a similar procedure always circa numbers which Size I do not know on designed to put auszulesen, the ever a designed Space in a String or area receive should. the has Beispielsweiße with the number 300 at read whom benefit, that I first beispielsweiße only 3 Bytes reservieren must, in the Order: Chr$(0) + Chr$(1) + Chr$(44), instead of for same number: MkStr$(0,Len(Str$(256*256*256))-3) + 300.

Timo
 
01/24/06  
 




Jac
de
Lad
sincere said understand I only railway-station and I no idea, what you mean!

Jac
 
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
01/24/06  
 




Timotheus
Yes, OK. I press me time again plenty To tricky from.
I miente solely, the one with such take action numbers everybody can in Strings commit extreme telescope can.

normal:
16777215 (8 characters)

Hexadeximal:
FFFFFF (6 characters)

256-Chr method:
Chr$(255) + Chr$(255) + Chr$(255) (3 characters)

here power itself the Maybe not yet noticeable, but particularly if one Riesenzahlen using must one sowiso on Strings adjust, and this is a excellently Komprimierung.

Timo
 
01/25/06  
 




Michael
Wodrich
[quote:9550d698e5]the has Beispielsweiße with the number 300 at read whom benefit, that I first beispielsweiße only 3 Bytes reservieren must, in the Order: Chr$(0) + Chr$(1) + Chr$(44), instead of for same number: MkStr$(0,Len(Str$(256*256*256))-3) + 300.
[/quote:9550d698e5]
On my computer occupied the String 300 too only 3 Bytes.

instead of the following??? who comes on so a bewildered idea?
(have it time aufgelöst)
CompileMarkSeparation
MkStr$("0",Len(Str$(256*256*256))-3) + "300"
MkStr$("0",Len(Str$(16777216))-3) + "300"
MkStr$("0",Len("16777216")-3) + "300"
MkStr$("0",8-3) + "300"
MkStr$("0",5) + "300"
"00000" + "300"
"00000300"<

Chr$(0) + Chr$(1) + Chr$(44)

means have You crept The Binärform the number as String displayed. The Order MSB...LSB having me first a little bit irritiert.

Best wishes
Michael Wodrich

MSB = most significant bit
LSB = least significant bit

the converting in numbers of/ one others Base can z.B. for simply-Verschlüsselung using go. it can itself Yes anytime turn round (if one The Base knows and white, that it itself circa a number deals).
 
Programmieren, das spannendste Detektivspiel der Welt.
01/25/06  
 




Jac
de
Lad
I peil the still not. can someone of you whom View source paraphrase?

@Michael: Sag time, Gibts for functions too a usage? me falls anyway no one...

Jac
 
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
01/25/06  
 




Michael
Wodrich
The one Posting moreover supra indicated View source ought to only The used Formel schrittweise dissolve (each row is a dissolution More). and end is then as Result:

If you a worth as 3-characters-Binärwert darstellst then is the kürzer as if You a String on 8 characters length with nobodies auffüllst.

means vergiß it simply, because the begot Binärstring won't sonderlich readable his.

Best wishes
Michael Wodrich

Chr$(0) + Chr$(1) + Chr$(44)
aufgelöst: (0*256 + 1) * 256 + 44 yields 300
 
Programmieren, das spannendste Detektivspiel der Welt.
01/25/06  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

7.408 Views

Untitledvor 0 min.
Peter Max Müller01/27/17
Heinz Bernhard08/19/13
Untitled05/26/12

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie