티스토리 뷰
// [C++] String Concatenation
// VC : suppress error messages about obsolete & deprecated functions
#pragma warning(disable : 4996)
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS_GLOBALS
#include <iostream>
#include <string>
using namespace std;
int main()
{
// string text0 = "Hello" + "World"; // error
string text1 = "Hello" "World";
cout << text1 << endl;
string word1 = "Hello";
string word2 = word1 + "World";
cout << word2 << endl;
char text2[11];
strcpy(text2, "Hello");
strcat(text2, "World");
printf(text2);
}
// [C#] String Concatenation
using System;
namespace Sharp1
{
class Program
{
static void Main(string[] args)
{
string text = "Hello" + "World";
Console.WriteLine(text);
}
}
}
# [Python] String Concatenation
def main():
text = "Hello" + "World"
print(text)
if __name__ == '__main__':
main()
// [Java] String Concatenation
package package1;
public class Program {
public static void main(String[] args) {
String text = "Hello" + "World";
System.out.println(text);
}
}
'Ongoing > String' 카테고리의 다른 글
[C# C++ Python] verbatim string, raw string literal (0) | 2019.04.19 |
---|---|
[C#] Composite Format String & Interpolated String (0) | 2018.07.09 |
for [C/C++] char[] string (0) | 2018.06.21 |
for [Java] String (0) | 2018.06.20 |
for foreach [C#] string (0) | 2018.06.20 |