String append: Difference between revisions

From Rosetta Code
Content deleted Content added
m initial draft task
No edit summary
Line 18: Line 18:
</pre>
</pre>


=={{header|python}}==
=={{header|Python}}==
'''File: String_append.py'''<lang python>#!/usr/bin/env python
'''File: String_append.py'''<lang python>#!/usr/bin/env python
# -*- coding: utf-8 -*- #
# -*- coding: utf-8 -*- #
Line 28: Line 28:
123456789!
123456789!
</pre>
</pre>

=={{header|Wart}}==
<lang wart>s <- "12345678"
s <- (s + "9!")</lang>

Revision as of 05:58, 3 October 2013

Task
String append
You are encouraged to solve this task according to the task description, using any language you may know.

Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.

You may see other such operations in the Basic Data Operations category, or:

Integer Operations
Arithmetic | Comparison

Boolean Operations
Bitwise | Logical

String Operations
Concatenation | Interpolation | Comparison | Matching

Memory Operations
Pointers & references | Addresses

Create a string variable equal to any text value. Append the string variable with another string literal.

To illustrate the operation, show the content of the variable.

ALGOL 68

Works with: ALGOL 68 version Revision 1 - one extension to language used - PRAGMA READ - a non standard feature similar to C's #include directive.
Works with: ALGOL 68G version Any - tested with release algol68g-2.7.

File: String_append.a68<lang algol68>#!/usr/bin/a68g --script #

  1. -*- coding: utf-8 -*- #

STRING str := "12345678"; str +:= "9!"; print(str)</lang>Output:

123456789!

Python

File: String_append.py<lang python>#!/usr/bin/env python

  1. -*- coding: utf-8 -*- #

str = "12345678"; str += "9!"; print(str)</lang>Output:

123456789!

Wart

<lang wart>s <- "12345678" s <- (s + "9!")</lang>