Design issue: client side or server side?
You must take into consideration a lot of factors, including and especially security ones. For example, if you must do some complicated form validation, then it is extremely important to do it server-side, even if that puts a little more load on the server.
Always keep in mind that a bad guy can change/break your javascript and send invalid (or possibly malicious) data to the server.
When it comes to web programming, the single and most important rule of all is:
Never trust the user. With anything. Period.
In your case (with the String), you probably can do it client-side and verify on the server that it's ok.
Whenever there is dilemma to do a particular task, which can be accomplished either by client side code or by using a server code, which should be preferred?
For example:
I can iterate through a javascript object and construct a string and then send it to server, or should i send the javascript object and process it in the server?
My views: whenever I come across this situation I use the client side code as it reduces the computation load on server. 
What has to be done in such a situation? Which is the right approach?