SPMod icon indicating copy to clipboard operation
SPMod copied to clipboard

String manager

Open voed opened this issue 7 years ago • 1 comments

Description

An awesome methodmap for strings to get rid of char arrays and simplify tones of code. Not sure it all possible, but would be great

Expected behavior (i.e. solution)

String str = "Hello world." // Overloading `=` operator.
str.Format("Foo. %s Bar.", str) // Self formatting,  => `Foo. Hello world. Bar.`
int len = str.Length // `Length` property. => characters count of `Foo. Hello world. Bar.`
str = "Foo. " + str + " Bar." // Overloading `+` operator => `Foo. Hello world. Bar.`
str == "Foo. Hello world. Bar." // Overloading `==` operator => strings equal or not
str.Equals("Foo. Hello world. Bar.", false) // Same as above, but with case sensitivity parameter

Example usage in player class.

String name = player.GetName() // GetName should return String instead of char[]
//Just instead of
new name[33]
player.GetName(name, charsmax(name))

Other Comments

Suggestions?

voed avatar Aug 02 '18 20:08 voed

Good idea

frolish avatar Sep 11 '18 13:09 frolish