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

Reuse Existing StringBuilder #3

Open
Fleshgrinder opened this issue Apr 11, 2021 · 0 comments
Open

Reuse Existing StringBuilder #3

Fleshgrinder opened this issue Apr 11, 2021 · 0 comments
Assignees
Labels
🎉 enhancement New feature or request
Milestone

Comments

@Fleshgrinder
Copy link
Owner

All functions construct their own StringBuilder instance, it would be great if users can pass an existing one, in case they use these functions as part of building another, bigger string.

Obviously it would be best if it would be possible to integrate seamlessly with functions like buildString in a way that users do not even have to pass in anything. However, this is impossible until we have multiple receiver support in Kotlin. But, we can add extension functions to StringBuilder instead that are almost as awesome. 😎

public fun StringBuilder.appendUpperCaseFormat(value: String, separator: Char, vararg ignore: Char): StringBuilder
public fun StringBuilder.appendUpperCamelCase(value: String, vararg ignore: Char): StringBuilder
public fun StringBuilder.appendUpperDashCase(value: String, vararg ignore: Char): StringBuilder
public fun StringBuilder.appendUpperSnakeCase(value: String, vararg ignore: Char): StringBuilder

public fun StringBuilder.appendLowerCaseFormat(value: String, separator: Char, vararg ignore: Char): StringBuilder
public fun StringBuilder.appendLowerCamelCase(value: String, vararg ignore: Char): StringBuilder
public fun StringBuilder.appendLowerDashCase(value: String, vararg ignore: Char): StringBuilder
public fun StringBuilder.appendLowerSnakeCase(value: String, vararg ignore: Char): StringBuilder
@Fleshgrinder Fleshgrinder added the 🎉 enhancement New feature or request label Apr 11, 2021
@Fleshgrinder Fleshgrinder added this to the 0.3.0 milestone Apr 11, 2021
@Fleshgrinder Fleshgrinder self-assigned this Apr 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant