- Joined
- Sep 16, 2012
- Messages
- 453
- Reaction score
- 211
- First Language
- English
- Primarily Uses
- RMMV
Built-in class Extension's v1.9.5
Author Sarlecc
Introduction
This script adds four new methods to the String class and three to the Array class more may be added in the future as I think of them.
Updates:
- v1.5 added three methods to the Array class and changed the name to Built-in class Extension's. (as it now handles more than just Strings)
- v1.6 added mix_up method to String class.
- v1.8 added search method to array class, added prime? method to Math module. Also due to the length of the script putting it up on mediafire.
- v1.9 added two new methods to the Array class. Also was having problems updating the script so the download link changed...
-v1.9.5 added new prime number checking algorithm. now check if a prime number is prime much faster (slower though on composite numbers)
Features
Screenshots
None needed
How to Use
Place script below materials and above main
Demo
Yea none needed.
Script
Script
GitHub
FAQ
None yet.
Credit
- Sarlecc
Terms
Author's Notes:
The difference between rand_chars and mix_up is mix_up only returns a string containing characters in that string. The rand_chars method returns random characters that do not necessarily show up in the string. I'm guessing that mix_up might be good for anagrams/scrabble style games?
Author Sarlecc
Introduction
This script adds four new methods to the String class and three to the Array class more may be added in the future as I think of them.
Updates:
- v1.5 added three methods to the Array class and changed the name to Built-in class Extension's. (as it now handles more than just Strings)
- v1.6 added mix_up method to String class.
- v1.8 added search method to array class, added prime? method to Math module. Also due to the length of the script putting it up on mediafire.
- v1.9 added two new methods to the Array class. Also was having problems updating the script so the download link changed...
-v1.9.5 added new prime number checking algorithm. now check if a prime number is prime much faster (slower though on composite numbers)
Features
Spoiler
- Can remove every other character
- Can add characters every other character
- Can convert a string to random characters.
- Can mix the characters in a string.
- Can find the mean.
- Can find the median.
- Can find the range.
- Can search for certain numbers in an array
- Can determine if a number is a prime number
- Can find the id in an array with the lowest value
- Can find the id in an array with the highest value
- Can remove every other character
- Can add characters every other character
- Can convert a string to random characters.
- Can mix the characters in a string.
- Can find the mean.
- Can find the median.
- Can find the range.
- Can search for certain numbers in an array
- Can determine if a number is a prime number
- Can find the id in an array with the lowest value
- Can find the id in an array with the highest value
Screenshots
None needed
How to Use
Place script below materials and above main
Code:
#==============================================================================
# String Extension by Sarlecc
#
# Strings
# "".remove_every(n, d) n = number, d = divsion (optional)
# "Example".remove_every(0, 3)# "".add_every(chars, n, d) chars = characters
# "Example".add_every("u", 2, 4)
# "".rand_chars
# "Example".rand_chars
# "".mix_up
#
# Arrays
# [].mean
# [].median
# [].range
# [].search(num1, num2) num2 is optional
#
# The following two methods return the id with the lowest or highest value in the given range
# both num1 and num2 are optional if omitted or values are to high then it will use 0 and the size
# of the array
# [].lowest(num1, num2)
# [].highest(num1, num2)
#
# Math
# Math.prime?(num)
# Math.prime2?(num)
# Math.prime2? is on average 2.5 times faster than Math.prime? if the number is prime; otherwise it is around 16-353 times slower
# its recommended that you use Math.prime? for checking thousands of numbers at a time as Math.prime2? will give an error (I assume
# that it has to do with the multithreading and attempting to do the next number while still doing the previous number).
# use Math.prime2? for checking larger primes
# Math.prime? time for number 18987964267331664557:
# 4521.762485 seconds
# Math.prime2? time for number 18987964267331664557:
# 1922.888493 seconds
# Math.prime? time for 106573388391:
# 0.000027-0.000028 seconds
# Math.prime2? time for 106573388391:
# 0.000452-0.009907 seconds
#==============================================================================
Demo
Yea none needed.
Script
Script
GitHub
FAQ
None yet.
Credit
- Sarlecc
Terms
Author's Notes:
The difference between rand_chars and mix_up is mix_up only returns a string containing characters in that string. The rand_chars method returns random characters that do not necessarily show up in the string. I'm guessing that mix_up might be good for anagrams/scrabble style games?
Last edited by a moderator: