Sign in to follow this  
Followers 0
speedi

need help to sort stock symbol list

13 posts in this topic

I have not been able to do this.. I tried script writer but that didn't go very well..

I have a list of stock symbols that I can paste into a text editor (like notepad). I want to sort the symbols (seperated by a space)...

Any help would be appreciated.... I think I would need to use an array, but have little experience with arrays...

Symbols list follows:

USSE SSTP AAPL APC APD ATHN CSCO CFX ED FWLT GDTI GLW GRMN GRWT MDR NOV NXSL OC OSUR PBR PRGN SBLK SXRZF WMT YHOO MSFT XMSR AMZN GOOG CELG COST CPRT EBAY HAL ICE ISRG LRY NHWK OMTR RIMM BIDU ROSE ACI PLT BRS

Share this post


Link to post
Share on other sites



Typically you would want to use something like a TAB or Comma, but for this spaces will be fine.

I wouldn't even bother copying into notepad... just read from the clipboard with ClipGet, and you'll get that string.

Then you can use StringSplit to create an array of all of the symbols.

How do you want to sort it?


Regards,Josh

Share this post


Link to post
Share on other sites

#include <Array.au3>
Global $str = 'USSE SSTP AAPL APC APD ATHN CSCO CFX ED FWLT GDTI GLW GRMN GRWT MDR NOV NXSL OC OSUR PBR PRGN SBLK SXRZF WMT YHOO MSFT XMSR AMZN GOOG CELG COST CPRT EBAY HAL ICE ISRG LRY NHWK OMTR RIMM BIDU ROSE ACI PLT BRS'
Global $str_A = StringSplit($str, ' ')
_ArraySort($str_A)
ConsoleWrite('!' & _ArrayToString($str_A, ' ', 1))


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Typically you would want to use something like a TAB or Comma, but for this spaces will be fine.

I wouldn't even bother copying into notepad... just read from the clipboard with ClipGet, and you'll get that string.

Then you can use StringSplit to create an array of all of the symbols.

How do you want to sort it?

Wow! That was fast!! sort alphabetically

Share this post


Link to post
Share on other sites

Wow! That was fast!! sort alphabetically

The answer is already there. How fast was that? muttley


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Like Xeno said... _ArraySort($str_A)


Regards,Josh

Share this post


Link to post
Share on other sites

Like Xeno said... _ArraySort($str_A)

OK here is my script that DID NOT work - it displayed symbols unsorted....

#include <Array.au3>

$symbols = ClipGet()

$array = StringSplit($symbols, ' ', 1)

_ArraySort($symbols)

MsgBox(4096, "Test", $symbols)

Share this post


Link to post
Share on other sites

#include <Array.au3>
Global $array = StringSplit(ClipGet(), ' ', 1)
_ArraySort($array)
MsgBox(4096, "Test", _ArrayToString($array, ' ' , 1))


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Was it a syntax error? Your code was a little off:

ClipPut(_ArrayToString($array, ' '))

Regards,Josh

Share this post


Link to post
Share on other sites

Was it a syntax error? Your code was a little off:

ClipPut(_ArrayToString($array, ' '))
yes it was syntax and I see what I had wrong!!! Job is done correctly now and I thank you and others for help.....

Share this post


Link to post
Share on other sites

yes it was syntax and I see what I had wrong!!! Job is done correctly now and I thank you and others for help.....

No problem, I suppose there will come up some new problems soon. muttley


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

And you will probably post the answer before the question is even asked muttley


Regards,Josh

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0