Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String manager #41

Open
voed opened this issue Aug 2, 2018 · 1 comment
Open

String manager #41

voed opened this issue Aug 2, 2018 · 1 comment

Comments

@voed
Copy link
Contributor

voed commented Aug 2, 2018

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?

@frolish
Copy link

frolish commented Sep 11, 2018

Good idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants