# Operations with Strings

> [`Tango.CommonOperations.StringOperations`](https://github.com/gabrielschade/Tango/blob/master/Tango/Tango/Operations/StringOperations.cs)

This *static* class contains methods and properties to expose common operations to work with `string` types.

All members bellow returns the corresponding functions as delegates.

## Properties

| Name    | Type                          | Description                                                                        |
| ------- | ----------------------------- | ---------------------------------------------------------------------------------- |
| Concat  | Func\<string, string>         | Function to represents concatenation operation string.Concat between two values.   |
| Concat3 | Func\<string, string, string> | Function to represents concatenation operation string.Concat between three values. |

## Methods

| Name        | Parameters                              | Returns                       | Description                                                                                                                                                     |
| ----------- | --------------------------------------- | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ConcatWith  | string value                            | Func\<string, string>         | Function to represents concatenation operation string.Concat between two values, applying first value as partial application on Concat function.                |
| Concat3With | string value                            | Func\<string, string, string> | Function to represents concatenation operation string.Concat between three values, applying first value as partial application on Concat3 function.             |
| Concat3With | <p>string value</p><p>string value2</p> | Func\<string, string>         | Function to represents concatenation operation string.Concat between three values, applying first and second values as partial application on Concat3 function. |

## Usage

The properties returns a delegate, so, it's possible to use it as a method.

&#x20;**Concat**

```csharp
string value = "Hello";
string value2 = " World";
string result = StringOperations.Concat(value, value2);

//result= "Hello World"
```

&#x20;**Concat3**

```csharp
string value = "Hello";
string value2 = " my ";
string value3 = "World";
string result = StringOperations.Concat3(value, value2, value3);

//result= "Hello my World"
```

Para os métodos temos uma sintaxe um pouco diferente, isso porque é realizada uma aplicação parcial ao método retornado pela própriedade.

Por conta disso, precisamos executar o método com os primeiros parâmetros, para obtermos um novo método que espera os parâmetros restantes:

&#x20;**ConcatWith**

```csharp
string value = "Hello";
string value2 = " World";
Func<string, string> concatWith = StringOperations.ConcatWith(value);
string result = concatWith(value2);

//result= "Hello World"
```

You can also use it as a chainable operation:

```csharp
string value = "Hello";
string value2 = " World";
string result = StringOperations.ConcatWith(value)(value2);

//result= "Hello World"
```

The *\~With* operations are available to `Concat3` as well, it follows the same caracteristics that the previous example.

&#x20;**Concat3With**

```csharp
string value = "Hello";
string value2 = " my ";
string value3 = "World";
Func<string, string, string> concat3With= StringOperations.Concat3With(value);
string result = concat3With(value2, value3);

//result= "Hello my World"
```

You can also use it as a chainable operation:

```csharp
string value = "Hello";
string value2 = " my ";
string value3 = "World";
string result = StringOperations.Concat3With(value)(value2, value3);

//result= "Hello my World"
```

You can use the two parameters overload as well:

```csharp
string value = "Hello";
string value2 = " my ";
string value3 = "World";
Func<string, string> concat3With= StringOperations.Concat3With(value, value2);
string result = concat3With(value3);

//result= "Hello my World"
```

```csharp
string value = "Hello";
string value2 = " my ";
string value3 = "World";
string result = StringOperations.Concat3With(value, value2)(value3);

//result= "Hello my World"
```


---

# 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://gabriel-schade-cardoso.gitbook.io/tango/operations/string.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.
