Question: So I have an array and I know how to find the highest value but I can't figure out how to obtain the position of that value in the array. The method so far is as follows:

```
 public static void findHottest(int[] temp){
        int hottest = temp[0];
        for(int i = 1; i < temp.length; i++){
            if(temp[i] > hottest) {
                hottest = temp[i];
            }
        }

```

Answer: 
You could use [Regex](http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex%28v=vs.110%29.aspx):

```
var myText = @"this is my text more text texttext and here comes something special [S p e c i a l string] more random text";
var pattern = @"\s+(?![^\[]*\])";
var output = new Regex(pattern).Replace(myText, "");

```

output will hold:

```
thisismytextmoretexttexttextandherecomessomethingspecial[S p e c i a l string]morerandomtext

```
How about something like this:

```
var result = string.Join("\"",
               test.Split('\"')
                   .Select((s, i) => i%2 == 1 ? s : s.Replace(" ", string.Empty)));

```

It splits the string by double quotes, and selects every alternate split item for the replacement operation - then joins them up again.