In FiM++, Strings are native types. Because of this, they should be able to interact with other native types using any operator.
Kyli Rouge[]
All proposed changes[]
- Add
description
to Princess Celestia
Add[]
An alternate way to do concatenation. In this case, the addition operator first inspects the two variables and sees that at least one is a string. It then combines the string and the string value of the other into a single temporary string and returns that.
Example[]
Did you know that
Rarity
likes
“Rari”
?
Did you know that
Applejack
likes
“Jack”
?
Did you know that
OTP
was
Rarity
and
Applejack
?
I said
OTP
.
Did you know that
dollar sign
was
“$”
?
Did you know that
price
was
19.99
?
I said
dollar sign
and
price
.
Subtract[]
Removes all instances of the right string from the left.
Removes the given number of characters from the right half of the string. If a non-integer is given, then round it to the nearest integer.
Examples[]
Did you know that
cider
is
“Apple Family apple cider made from real Apple family apples grown in Sweet Apple Acres”
?
I said
cider
without
“Apple ”
.
Did you know that
Twilight Sparkle
is
“a student unicorn”
?
I said
Twilight Sparkle
minus
8
.
Multiply[]
Primary proposition[]
Concatenates the left string with itself a given number of times times and returns the result.
Examples[]
I said
“Pinkie Pie”
times
3
.
Secondary proposition[]
Same behavior as above, but using suffix notation to allow for a more English-sounding phrase.
Examples[]
I said
“Pinkie Pie”
3
times
.
Divide[]
Returns the first 1/number
of the given string's characters. For instance, if a string is 20 characters long, then dividing it by 4 will return its first 5 characters.
Example[]
I said
“Pinkie PiePinkie PiePinkie Pie”
divided by
3
.
toString[]
For this to work properly, every object must have a toString-style method, which allows it to be converted into a string.
<keyword:method begin>
<whitespace>
description
<whitespace>
<returns>
<whitespace>
<type:string>
[ <nothing>
/ <whitespace>
] <punctuation>