How to flush the value of StringBuilder variable in android?
I am working on an android app in which i have a static StringBuilder variable named DT开发者_StackOverflow社区_selected.I want to flush this variable's value on a checkbox check.Anyone have any idea or experience how to do it?
I'm not exactly sure what you are looking to do but you can't "flush" a string builder, its not a stream. You can get its contents with toString()
or you can create a new empty string builder:
builder = new StringBuilder();
i have used...
someStringBuilder.Remove(0,someStringBuilder.Length);
or
string theString = someStringBuilder.ToString();
someStringBuilder.Replace(theString,"");
it will help u...
精彩评论