Java: How to “mutate” a string, despite a string's immutability?

navinarrows

New Member
I am developing an API as a bit of a student hobby-project, and I'm using a url where different options can be added/subtracted to change the information received. I know strings are immutable, which has made things a bit challenging to work around neatly. I've come up with a few a messy ways, none that robust, to solve it, and I'm wondering if there is a standard approach. I plan to have radio buttons (not assigned to a button a group; want all permutations) that will allow me to "include", "add", and "exclude" options. Thus, here is the string \[code\]z?s=GOOG&t=7m&z=l&q=l&p=e50,m50&a=ss,sfs,vm,w14\[/code\] used to interact with YahooFinance API. So, assume that I have some variable like this: \[code\] String options="z?s=GOOG&t=7m&z=l&q=l&p=e50,m50&a=ss,sfs,vm,w14"\[/code\]Now, consider the part that says \[code\]p=e50,m50\[/code\]. Suppose I have three radiobuttons \[code\]50\[/code\],\[code\]100\[/code\],\[code\]200\[/code\] that I want to tick on/off to such that I'd have a string \[code\]p=e50,m50,e100,m100,e200,m200\[/code\] with all buttons on, and every possible other combination; i.e. with \[code\]100\[/code\] off, it would look like: \[code\]p=e50,m50,e200,m200\[/code\]. Any thoughts? I'd like to ultimately do the same with the other value (\[code\]ss,sfs\[/code\], etc.) as well, however, let's just start with the moving averages.
 
Back
Top