# Condense()

The method behaviour can be modified using these options:

* *Default*: All kinds of characters are condensed.
* *OnlyWhiteSpace*: Only whitespace characters are condensed.
* *IgnoreCase*: The upper- and lowercase form of a character are treated as identical. Nevertheless, the leading character of each sequence retains its case in the result.

{% hint style="warning" %}
Different types of whitespace (space, tab, etc.) are represented by distinct chars, and, therefore, are not considered identical.
{% endhint %}

{% hint style="info" %}
Included since 📦**v1.2.0**
{% endhint %}

#### **Cute Illustration**

`🌳🌳🌴🌴👻👻☁️🌳🌳🌳` → `🌳🌴👻☁️🌳`

#### **Example**

```csharp
// Suppose we have a string variable with sequences of the same character.
var myString = "··\t··FfoooBaAr";

// By default, all kinds of characters are condensed.
var condensedString_Default = myString.Condense();
// Value of 'condensedString_Default' is "·\t·FfoBaAr" now.

// Option: OnlyWhiteSpace.
var condensedString_OnlyWhiteSpace = myString.Condense(StringCondenseOptions.OnlyWhiteSpace);
// Value of 'condensedString_OnlyWhiteSpace' is "·\t·FfoooBaAr" now.

// Option: IgnoreCase.
var condensedString_IgnoreCase = myString.Condense(StringCondenseOptions.IgnoreCase);
// Value of 'condensedString_IgnoreCase' is "·\t·FoBar" now.

// In each case, the original 'myString' variable remains unchanged.
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mx-pl.gitbook.io/extendedtypes-docs/string/condense.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
