Re: How to convert From Hex to Decimal
Charles Urbina wrote:
>
http://www.elfqrin.com/esndhconv.html
I couldn't find a description of the algorithm anywhere but since the
web page cited does it all in Javascript I figured it couldn't be too
hard to decipher. 100+ lines of Javascript came down to this:
function ESNHexToDecimalString(Value: string) : String;
function Convert(HexString : string; Len : integer) : String;
begin
if trim(HexString) = '' then Result := '0' else
Result := IntToStr(StrToInt('$' + trim(HexString)));
while length(Result) < Len do Result := '0' + Result;
end;
begin
Result := Convert(copy(Value, 1, 2), 3) +
Convert(copy(Value, 3, Length(Value)), 8);
end;
--
-Mike (TeamB)
.
Relevant Pages
- Re: Dynamic variable names
... In Javascript, being "object" oriented, you can access every element ... For instance knowing that a variable is named foo ... string, If a string, it should gon in between quotes. ... ALSO out of the window object, if a variable belongs to it. ... (comp.lang.javascript) - Re: Encodings of javascript
... How does javascript know that the string it is given is encoded using ... How does the string get inserted into the HTML with UTF-8 encoding? ... The DOM API uses the DOMString type, ... If the browser is Open Source, you can UTSL to confirm that. ... (comp.lang.javascript) - Re: [a,b].join() !== + a + b; // for some a and b
... returns "The string that results from converting each element ... I was asking why you were bothering us with the deficiencies of a book that has already been acknowledged here as having deficiencies. ... That is, if you read self-consistent BS you may perceive that as a learning experience, up until the time that you find out that it is BS, at which point the perception of the experience is inverted. ... As the only point I have made about those book here is that grandiose wording in a title does not imply anything about content, are you asking me to propose a javascript book with a more down-to-earth title? ... (comp.lang.javascript) - Re: fancy menu
... neither will interrupt running javascript code (because javascript ... Where browser do not support function reference arguments to - setTimeout - they also do not support function reference ... However, a compatibility trick exists, and follows from the observation that when - setTimeout/setInterval - only accept string arguments they type-convert whatever argument they get into a string and so you can reliably use function references in environments that only support string arguments by providing the function object with a - toString - method that outputs a string of code that will effectively call the function in question by less-direct means. ... (Bearing in mind that the - toString - method will be called along with the call to setInterval/setTimeout, not at the point when the timeout/interval expires). ... (comp.lang.javascript) - Re: Using AJAX/JSON and performance issues with eval()
... evalevaluates its string argument as an ECMAScript ... JS arrays are implemented as objects, ... multiple HTML tables automatically in the background) and really want it ... Prototype.js was written by people who don't know javascript for people ... (comp.lang.javascript) |
|