some yolol methods ideas

Joined
Apr 29, 2021
Messages
19
#1
some possible reuse of the current functions for strings

STR/# would give a string of all chars after the #th char (neg numbers would count from end)
#/STR would give a string of all chars before the #th char (neg numbers would count from end)
STR/str would give the first position of one string(str) in the the other(STR)
STR%str would give the the number of (str)s in STR
STR! would give length
STR*1 could caps a string with STR*0 would uncap (or negs for uncap)
STR^str would be endswith
--STR and ++STR could do that at the beginning of the string
STR + # and STR - # would do the same many times
 
Joined
Apr 29, 2021
Messages
19
#2
from [SER] NTPS #freekodey idea on division and multi

"String Multiplication:
a = "abc"
a * 3 -> "abcabcabc"

Based on the definition of multiplication a*3=a+a+a

String Division:
b = "blam is a test"
b / 4 -> "blam"
b / -4 -> "test"

Works to select parts of a string:
"abcabcabc" / 3 -> "abc"
"abcabcabc" / -3 -> "abc"
Therefore ("abc" * 3)/3 = "abc"
Also serves the 'opposite' of this version of multiplication, being able to 'undo' it, also as per the mathematical definition.

How it handles decimals:
c = "abc"
c * 1.5 -> "abcd"
Implementation:
3char * 1.5 = 4.5 -> Round down to 4 -> 4char result

Similar approach for division:

d = "abcdef"
d / 4 -> "ab"
d / -4 -> "ef"
Implementation:
6char / 4 = 1.5 -> Round up to 2 -> first 2char result
6char / -4 = -1.5 -> Round down to -2 -> last 2char result

Once again, it also maintains parity with multiplication, 'undoing' it by definition.
"abcd" / 1.5 -> "abc"
Therefore ("abc" * 1.5) / 1.5 = "abc"

For this % will take the number functions of /

STR%# would give a string of all chars after the #th char (neg numbers would count from end)
#%STR would give a string of all chars before the #th char (neg numbers would count from end)"

and ^ takes the roles of *
STR^1 could caps a string with STR^0 would uncap (or negs for uncap)
 
Top