Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: I don't know if this is possible or not...

  1. #1
    Join Date
    Apr 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I don't know if this is possible or not...

    But, could a script output an array of text in order? i.e. a, b, c, d, e, f, g, etc., etc.

    But to a large proportion? Like aaaaaaaa all the way to zzzzzzzz?

    If it is possible, would the script have to include everything in between the sequences?

    Thanks in advance.

  2. #2
    Join Date
    Jan 2007
    Location
    Manila, Philippines
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes it is possible, maybe your talking about sorting?right?

  3. #3
    Join Date
    Apr 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    No...outputing an array of text. All the way from aaaaaaaa to zzzzzzzz.

    i.e. aaaaaaaa, aaaaaaab, aaaaaaac, - aahilsne, aahilsnf - zzzzzzzy, zzzzzzzz

    A lot of text, yea, but it'd be very helpful. Is that possible?

  4. #4
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well I have low experience at arrays seeing as I don't completely understand them yet but as far as I know about it you can eigther write it yourself in order or use something like sort (but i'm very unsure)....

    Well I guess will spend my time right now looking it up for you ...

    I will post back when I have some results....

  5. #5
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    LOL, I already found the answer -
    http://www.mickweb.com/javascript/ar...ingArrays.html

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    How do:

    aahilsne, aahilsnf

    fit in this sequence:

    aaaaaaaa, aaaaaaab, aaaaaaac, . . . , zzzzzzzy, zzzzzzzz

    ? In fact, how do you get from incrementing the last letter each time as in the first three entries to having all but the last letter incremented? Anyways, there might be a way to fit all that into a logical progression. For the time being there is this:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script type="text/javascript">
    var theStrings=[];
    var aString=[97,97,97,97,97,97,97,97];
    var pos=aString.length-1
    function buildArray(){
    var str='';
    for (var i_tem = 0; i_tem < aString.length; i_tem++)
    str+=String.fromCharCode(aString[i_tem]);
    theStrings[theStrings.length]=str;
    }
    function incString(){
    pos=pos<0? aString.length-1 : pos;
    aString[pos--]++;
    }
    while (aString[0]<122){
    buildArray();
    incString();
    }
    theStrings[theStrings.length]='zzzzzzzz';
    </script>
    </head>
    <body>
    <script type="text/javascript">
    for (var i_tem = 0; i_tem < theStrings.length; i_tem++)
    document.write(theStrings[i_tem]+'<br>\n');
    </script>
    </body>
    </html>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Apr 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i.e. aaaaaaaa, aaaaaaab, aaaaaaac, - aahilsne, aahilsnf - zzzzzzzy, zzzzzzzz
    The dashes signified "through"

    That is close to what I need, thank you, but I need it with much more info...

    I need it to go from aaaaaaaz to aaaaaaba, then continue from that to aaaaaabz, then go to aaaaaaca, etc., etc.

    It'll be MUCH longer then that, but would be really helpful if that would be possible.
    Last edited by SessTehKing; 04-04-2007 at 11:20 PM.

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I know what you mean, but it sounds like a homework assignment to me...
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Sometimes (always, actually) getting the answer via search engine will help. Pointlessly posting questions on forums gets annoying from time to time.
    http://www.google.ca/search?hl=en&cl...G=Search&meta=
    - Mike

  10. #10
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    This is also a possibility:
    Code:
    <script type="text/javascript">
    var test=["mike","jaen","lard","wavey","karyn","azulin"];
    Array.prototype.arr_sort = function(it) {
    	var n = this,x=Array();
    	n.sort();
    	for (var i=0;i<n.length;i++) {
    		x.push(n[i]);
    		}
    	if (typeof it == "undefined") {
    		return x;
    		}
    	else {
    		return n[it];
    		}
    	}
    
    var myArray = test.arr_sort();
    alert(myArray[3])
    </script>
    - Mike

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •