hi everybody.....
can anybody provide me a java code for the following problem......
i want that if user enters input like this:
sam,john,undertaker,rock
the output should be:
'sam','john','undertaker','rock'
i.e , is converted to ',' and the string starts with ' and ends with '
i have a javascript code for this and it is reproduced below to have full view of the problem.........
<HTML>
<BODY>
<script type="text/javascript">
function CONVERT(){
var re=/[,]/g
for (i=0; i<arguments.length; i++)
arguments[i].value="'" + arguments[i].value.replace(re, function(m){return replacechar(m)}) + "'"
}
function replacechar(match){
if (match==",")
return "','"
}
</script>
<form>
<textarea name="data1" style="width: 400px; height: 100px" ></textarea><br />
<input type="button" value="submit" name="button" onclick="CONVERT(this.form.data1)">
</form>
</BODY>
</HTML>
can anyone do it for me.
thx in anticipation
kaleena


Reply With Quote


Bookmarks