Personal tools
You are here: Home Projects C++ Cfront releases Release 3.0.3 source demo string append.c
Document Actions

append.c

by Michael L Powell last modified 2007-01-26 03:20

Click here to get the file

Size 1.5 kB - File type text/plain

File contents

/*ident	"@(#) @(#)append.c	1.1.1.2" */
/******************************************************************************
*
* C++ Standard Library
*
* Copyright (c) 1996  Lucent Technologies.  All Rights Reserved.
*
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Lucent Technologies.
* The copyright notice above does not evidence any actual or
* intended publication of such source code.
*
******************************************************************************/

#include <iostream.h>
#include <string>

main() {
	string s1;
	cout << "s1=<" << s1 << ">\n";
	cout << "s1=<>\n";
	string s2 = "abc";
	cout << "s2=<" << s2 << ">\n";
	cout << "s2=<abc>\n";
	string s3("abcdefghi", 5);
	cout << "s3=<" << s3 << ">\n";
	cout << "s3=<abcde>\n";

	s1 = s2;
	cout << "s1=<" << s1 << ">\n";
	cout << "s1=<abc>\n";

	s1 += "def";
	cout << "s1=<" << s1 << ">\n";
	cout << "s1=<abcdef>\n";
	
	s1 += s2;
	cout << "s1=<" << s1 << ">\n";
	cout << "s1=<abcdefabc>\n";

	s1.append(s3, 1, 3);
	cout << "s1=<" << s1 << ">\n";
	cout << "s1=<abcdefabcbcd>\n";

	s1 = s2;
	s1.append(s3);
	cout << "s1=<" << s1 << ">\n";
	cout << "s1=<abcabcde>\n";

	s1 = s2;
	s1.append("abcjkl", 4);
	cout << "s1=<" << s1 << ">\n";
	cout << "s1=<abcabcj>\n";

	s1.append("xyz");
	cout << "s1=<" << s1 << ">\n";
	cout << "s1=<abcabcjxyz>\n";

	s1 = s2;
	s1.append(5, 'c');
	cout << "s1=<" << s1 << ">\n";
	cout << "s1=<abcccccc>\n";

	s1 = s2;
	s1 += 'j';
	cout << "s1=<" << s1 << ">\n";
	cout << "s1=<abcj>\n";

	return (0);
}
« October 2014 »
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: