> For the complete documentation index, see [llms.txt](https://brianwu.gitbook.io/brian/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://brianwu.gitbook.io/brian/asp.net-web-form/chapter-2/2-1/xiao-dong-xi.md).

# 小東西

## 大量字串串接

```
String str = null();

System.Text.StringBuilder sb = new System.Text.StringBuilder();
for(int i = 0;i<=100;i++)
{
    sb.Append(i.ToString() + "<br>");
}

Response.write(sb.ToString());
```

## String 常用方法

## C#的foreach

```
String str = "abcde";
str.length //5
str.Replace("ab","ba"); //bacde
str.Contains("cd"); //true
str.IndexOf("d"); //3
str.IndexOf("g"); //-1
str = "Hello world, I love C#.";
String[] arr = str.Spilt(' ');

foreach(String s in arr)
{
    Response.write("<br>" + s);    
}
//
Hello
world,
I
love
C#.
```
