开发者

Searching an item from string builder object

开发者 https://www.devze.com 2023-01-12 07:53 出处:网络
StringBuilder displayList = new StringBuilder(); I have added a few items in displayList but in my code i need to search for an item in displayList how can i search an item added开发者_如何学Python
StringBuilder displayList = new StringBuilder();

I have added a few items in displayList but in my code i need to search for an item in displayList how can i search an item added开发者_如何学Python to displayList please let me know


You can't search until you convert it to string using the ToString method.


        StringBuilder displayList = new StringBuilder();
        displayList.Append( "ABC" );
        string toFind = "B";
        if( displayList.ToString().Contains(toFind) ) {
            //found it
        }
0

精彩评论

暂无评论...
验证码 换一张
取 消