COOKIES
THIS WEBSITE USES COOKIES
Strings entered into this website for the purpose of concatenation are not persisted or saved. However, this site uses cookies to store your preferences. If you wish to opt out of cookies, you may still use this website, however your preferences will not be stored from session to session. You may always return to this section to change your cookie preference. Clicking "Save Setting" will cause the page to reload.
Use Cookies:
Save Setting Don't Save
Concatenação automática de string. Geração automática de código de Stringbuilder.
Não seria ótimo simplesmente colar sua enorme consulta SQL ou outro grande bloco de texto em algum lugar e, em seguida, ter uma string concatenada ou um objeto StringBuilder magicamente formado em torno dele? (Resposta: Sim, seria) Agora você pode criar automaticamente strings concatenadas e criar objetos StringBuilder automaticamente. Qualquer texto que você inserir, serão concatenados e produzirá os resultados desejados. Se você encontrar um problema ou quiser oferecer uma ideia de alteração ou aprimoramento, anote nos comentários. Por favor, continue com suas sugestões!!!! Vamos transformar e evoluir! O site lembrará suas configurações se você ativar os cookies no canto superior esquerdo do site. E não, suas strings não são registradas ou salvas de forma alguma - não desejo saber o que as pessoas digitam aqui.

Não use o navegador Internet Explorer.

Linguagem Alvo
C#
Java
VB.NET
C++
Target SQL
Huh?
Microsoft - T-SQL
Oracle - PL / SQL
MySql - SQL / PSM
Objeto alvo:
String (concatenação)
Stringbuilder
Não (saída de string somente)
Preservar linhas em branco na entrada como saída? Huh?
Nome da variável (25 max) Huh?
Espaços desnecessários à direita do texto
Ignora
Remova todos os espaços encontrados no final de cada linha Huh?
Opções
Não
Incluir um <br> no final de cada linha Huh?
Incluir \r\n no final de cada linha Huh?
Incluir um espaço no final de cada linha Huh?
Inclua isso no início de cada linha (25 max) Huh?
Inclua isso no final de cada linha (25 max) Huh?
Lindando com Tabs
Ignora Tabs Huh?
Retire qualquer Tabs Huh?
Replace Tabs com \t ou vbTAB Huh?
Replace Tabs com um espaço Huh?
MS Opções Específicas
Não
Use AppendLine em vez de Append para o objeto Stringbuilder Huh?
VB somente - inclui " & vbCrLF &" no final de cada linha, FORA da string Huh?

Beleza
Indentar meu objeto Huh?
Use uma única declaração Huh?
Retira CR(carriage returns) Huh?

Entre com o texto

Fechar (X)
Às vezes, como pode ser o caso do código ou de uma consulta SQL, você pode querer preservar linhas em branco em sua string ou código Stringbuilder para fins de legibilidade:
// Sample code follows

for(int i=0; i<5; i++)
{
Console.WriteLine("Current Count: " + i.ToString());
}

Console.WriteLine("Final Count: " + i.ToString());
Checking this box will preserve your blank lines in the output:
StringBuilder sb = new StringBuilder();

sb.Append("// Sample code follows");
sb.Append("");
sb.Append("for(int i=0; i<5; i++) ");
sb.Append(" {");
sb.Append(" Console.WriteLine(\"Current Count: \" + i.ToString());");
sb.Append(" }");
sb.Append("");
sb.Append("Console.WriteLine(\"Final Count: \" + i.ToString());");
Or, leave this box unchecked and blank lines in the input will not be included in the output:
StringBuilder sb = new StringBuilder();

sb.Append("// Sample code follows");
sb.Append("for(int i=0; i<5; i++) ");
sb.Append(" {");
sb.Append(" Console.WriteLine(\"Current Count: \" + i.ToString());");
sb.Append(" }");
sb.Append("Console.WriteLine(\"Final Count: \" + i.ToString());");
Observe que, se você selecionar a opção para preservar linhas em branco E qualquer uma das opções que incluam caracteres adicionais no final de cada linha, a saída também anexará esses caracteres às suas linhas em branco.
Fechar (X)
Fechar (X)
By default, the output will use the name of "sb" for your string or stringbuilder. Feel free to change it to anything you prefer:
StringBuilder greatestObjectEver = new StringBuilder();
Fechar (X)
Fechar (X)
If you're outputting text to an HTML doc, you can select this option to have a <br> appended at the end of each line of the input:
StringBuilder sb = new StringBuilder();

sb.append("Four score and seven years ago<br>");
sb.append("our fathers brought forth on this continent,<br>");
sb.append("a new nation, conceived in Liberty,<br>");
sb.append("and dedicated to the proposition that<br>");
sb.append("all men are created equal.<br>");
Close (X)
Close (X)
When inputting multiple lines of text, you might be expecting the words to seperate properly at the line breaks:
Four score and seven years ago
our fathers brought forth on this continent,
a new nation, conceived in Liberty,
and dedicated to the proposition that
all men are created equal.
However, most multi line text will terminate right after the last character of the line creating an unexpected result in the output:
StringBuilder sb = new StringBuilder();

sb.Append("Four score and seven years ago");
sb.Append("our fathers brought forth on this continent,");
sb.Append("a new nation, conceived in Liberty,");
sb.Append("and dedicated to the proposition that");
sb.Append("all men are created equal.");

OUTPUT: Four score and seven years agoour fathers brought forth....
By checking this box, a space will be appended to the end of each line:
StringBuilder sb = new StringBuilder();

sb.Append("Four score and seven years ago ");
sb.Append("our fathers brought forth on this continent, ");
sb.Append("a new nation, conceived in Liberty, ");
sb.Append("and dedicated to the proposition that ");
sb.Append("all men are created equal. ");

OUTPUT: Four score and seven years ago our fathers brought forth....
Close (X)
Close (X)
You may need to append something custom to the end of each line. You can enter a custom suffix here. (Note if you use a custom suffix, it will NOT be escaped, you must do that yourself.)
Text::StringBuilder^ sb = gcnew Text::StringBuilder;

sb->Append("Four score and seven years ago\n");
sb->Append("our fathers brought forth on this continent,\n");
sb->Append("a new nation, conceived in Liberty,\n");
sb->Append("and dedicated to the proposition that\n");
sb->Append("all men are created equal.\n");
Close (X)
Close (X)
For C#, VB.NET, and C++, select this option to use AppendLine instead of Append for the Stringbuilder object. AppendLine will add the default line terminator to the end of each line: (This option has no effect if the target object is a concatenated string or if the target language is Java)
sb.AppendLine("Four score and seven years ago");
sb.AppendLine("our fathers brought forth on this continent,");

OUTPUT: Four score and seven years ago
our fathers brought forth on this continent,
Close (X)
Close (X)
For a VB.NET concatenated string only, selecting this option will append the VB carriage return constant at the end of each line of the string. This option only applies if VB.NET is the target language and the target object is a concatenated string.
Dim sb As String
sb = "Four score and seven years ago" & vbCrLf &
"our fathers brought forth on this continent," & vbCrLf &
"a new nation, conceived in Liberty"

OUTPUT: Four score and seven years ago
our fathers brought forth on this continent,
a new nation, conceived in Liberty
Close (X)
Close (X)
Tabs can display unpredictably unless they are handled. If you are certain your source text has no Tabs, this option is fine. Otherwise, use one of the options below.
Close (X)
Close (X)
Strip out any Tabs that are found in the source text. This can be useful to remove unwanted Tabs, but keep in mind anything seperated by a Tab in the source text will no longer be seperated in the output:
Source Text (separated by Tabs): Column1 Column2 Column3

OUTPUT: Column1Column2Column3
Close (X)
Close (X)
Replace any Tabs found with \t or, if VB.Net is selected, vbTAB. If there are Tabs in your source text that you wish to preserve, this is the option.
Source Text (separated by Tabs):
Col1 Col2
Data1 Data2
Data1 Data2

OUTPUT:
Dim sb As String
sb = "Col1" + vbTab + "Col2" & vbCrLf &
"Data1" + vbTab + "Data2" & vbCrLf &
"Data1" + vbTab + "Data2"
Close (X)
Close (X)
Replace any Tabs found with a space. This can be useful for formatting source text that is Tab delimited or copied from a spreadsheet:
Source Text (separated by Tabs):
Col1 Col2
Data1 Data2
Data1 Data2

OUTPUT:
string sb = "Col1 Col2\r\n" +
"Data1 Data2\r\n" +
"Data1 Data2\r\n";
Close (X)
Close (X)
If you're outputting text that's not HTML, you can select this option to have \r\n appended at the end of each line of the input.
(This is ignored for VB.Net. There is an option below to append vbCrLF.)
StringBuilder sb = new StringBuilder();

sb.append("Four score and seven years ago\r\n");
sb.append("our fathers brought forth on this continent,\r\n");
sb.append("a new nation, conceived in Liberty,\r\n");
sb.append("and dedicated to the proposition that\r\n");
sb.append("all men are created equal.\r\n");
Close (X)
Close (X)
This option will remove any spaces found at the end of each line. This can be useful when dealing with cut and pasted fixed length data:
Source Text - data is char(20):
Value1              (^end of line is here)
Another Value       (^end of line is here)
Yet another value   (^end of line is here)

OUTPUT (no trailing spaces):
string sb = "Value1\r\n" +
"Another Value\r\n" +
"Yet another value\r\n";
Close (X)
Close (X)
This option will insert a Tab in front of each line of your generated code. This is purely for formatting reasons, as shown:
Indent off:
sb.Append("Hello World");
sb.Append("Hope you're well!");

Indent on:
      sb.Append("Hello World");
      sb.Append("Hope you're well!");
Close (X)
Close (X)
For a string builder (C# and Java only), selecting this option will build all the appends as a single statement. This will allow the entire string builder to stepped over all at once in the debugger rather than having to step through each line. When debugging with very large string builders, this option will save a lot of time:
Standard way:

StringBuilder sb = new StringBuilder();

sb.Append("Here is my ");
sb.Append("string builder.");
sb.Append("Guess I'll");
sb.Append("have");
sb.Append("to step through line by line.");

Single statement:

StringBuilder sb = new StringBuilder();

sb.Append("Wait, no I wont!")
.Append("This")
.Append("whole")
.Append("thing")
.Append("debugs as one statement!");
Close (X)
Close (X)
BuildMyString.com will now escape and concatenate SQL strings

Some ground rules: When you select any of the SQL languages, you are getting a concatenated string. I don't care if you pick 'StringBuilder' or 'None', it's not happening. You are getting a concatenated string.

If you are staring at your ceiling right now yelling at the top of your lungs, "But I want to use a StringBuilder in SQL and you can't stop me!!", well I can stop you and you're a very strange person who shouldn't be writing code to begin with. Similarly, if you are currently screaming at your cat - "But I use SillySQL! They haven't coded support for SillySQL!?!?!".

Look I can only do so much. I picked 3 common SQL platforms and maybe it's time you upgraded from SillySQL to an industry standard.

Also, some of these options obviously make no sense at all in SQL, but are still available should you wish to use them. Weirdo.

Close (X)
Close (X)
Selecting this option will strip out any carriage returns in your text and return a single line as output. Useful if you if you have a large block of text you'd like as a single line in your code or "pivoting" your string.
Standard way:

string sb = "1" +
"2" +
"3" +
"4";

Strip out carriage returns:

string sb = "1 2 3 4";
Close (X)
Close (X)
You may need to prepend something custom to the beginning of each line. You can enter a custom prefix here. (Note if you use a custom prefix, it will NOT be escaped, you must do that yourself.)
Text::StringBuilder^ sb = gcnew Text::StringBuilder;

sb->Append("\nFour score and seven years ago");
sb->Append("\nour fathers brought forth on this continent,");
sb->Append("\na new nation, conceived in Liberty,");
sb->Append("\nand dedicated to the proposition that");
sb->Append("\nall men are created equal.");
Close (X)