[Library scripts] Sorts and strings - updated 2007-03-05
Posted: Mon, 8. Jan 07, 00:02
Hi,
While writing the scripts for 'Remote Docked Freight/Upgrade Transfer', I needed a good sort script, but did not have access to this forum to find one... so I had to write my own.
I have books for many computer languages, and they had programs listed, so I converted them to X3 scripting language.
The files in the package are the result of this work, and are being made freely available for anyone to use as they wish.
The .zip file consists of the .xml files themselves, and a document containing listings of the files - together with the original c code, or pascal code. This file is not formatted for printing, just for looking at onscreen - there are 28 pages, over 1500 lines.
The .xml files were converted to text files using the very useful "XML to plain text" program by Bunny.
Updated 2007-03-05
Added formattime and csv from a t-file
Sorts:-
- Bubble - alpha and numeric
- Insertion - alpha and numeric
- Selection - alpha and numeric
- Shell - alpha and numeric
And the best sort in this collection:-
- Improved Shell - alpha and numeric plus 2-linked array alpha and numeric, and a 2d-array alpha where you select the element to sort on.
After sorts
- Merge sorted alpha
- Remove duplicates from a sorted array
Strings
- Convert case to upper or lower
- Format a number with commas - or you choose
- Isalpha - check if a string consists solely of alpha characters
- Isnumeric - check if a string consists solely of numeric characters
- Isnumericwithsign - check if a string consists solely of numeric characters after a leading + or - character
- Splitstring - splits a string at the space character and returns an array of the parts
2007-03-05
- FormatTime - formats game time to dd-hh:mm:ss
- Splitcsvstring - splits a string at the comma character and returns an array of the parts
Useful
Getarray.myshipsdockedat - returns an array of player-owned ships docked at a location.
2007-03-05
Readincsv - reads in csv data from a t-file
Version 2
.zip file - courtesy of Xai Corp.
[Edit] If you do want to use these scripts in your own packages - copy and rename to whatever you want, as some of them are used in the Remote Docked Freight/Upgrade Transfer - and changes to the library scripts might break it. [/Edit]
Use as you wish,
Boron - Ol Fh'art
While writing the scripts for 'Remote Docked Freight/Upgrade Transfer', I needed a good sort script, but did not have access to this forum to find one... so I had to write my own.
I have books for many computer languages, and they had programs listed, so I converted them to X3 scripting language.
The files in the package are the result of this work, and are being made freely available for anyone to use as they wish.
The .zip file consists of the .xml files themselves, and a document containing listings of the files - together with the original c code, or pascal code. This file is not formatted for printing, just for looking at onscreen - there are 28 pages, over 1500 lines.
The .xml files were converted to text files using the very useful "XML to plain text" program by Bunny.
Updated 2007-03-05
Added formattime and csv from a t-file
Sorts:-
- Bubble - alpha and numeric
- Insertion - alpha and numeric
- Selection - alpha and numeric
- Shell - alpha and numeric
And the best sort in this collection:-
- Improved Shell - alpha and numeric plus 2-linked array alpha and numeric, and a 2d-array alpha where you select the element to sort on.
After sorts
- Merge sorted alpha
- Remove duplicates from a sorted array
Strings
- Convert case to upper or lower
- Format a number with commas - or you choose
- Isalpha - check if a string consists solely of alpha characters
- Isnumeric - check if a string consists solely of numeric characters
- Isnumericwithsign - check if a string consists solely of numeric characters after a leading + or - character
- Splitstring - splits a string at the space character and returns an array of the parts
2007-03-05
- FormatTime - formats game time to dd-hh:mm:ss
- Splitcsvstring - splits a string at the comma character and returns an array of the parts
Useful
Getarray.myshipsdockedat - returns an array of player-owned ships docked at a location.
2007-03-05
Readincsv - reads in csv data from a t-file
Version 2
.zip file - courtesy of Xai Corp.
[Edit] If you do want to use these scripts in your own packages - copy and rename to whatever you want, as some of them are used in the Remote Docked Freight/Upgrade Transfer - and changes to the library scripts might break it. [/Edit]
Use as you wish,
Boron - Ol Fh'art