Dec 122017
String Class compatible with Borland container classes. High performance.
File STRX.ZIP from The Programmer’s Corner in
Category C++ Source Code
String Class compatible with Borland container classes. High performance.
File Name File Size Zip Size Zip Type
BCSTR.CPP 1328 561 deflated
BCSTR.H 1716 668 deflated
DYNSTREA.CPP 2247 856 deflated
DYNSTREA.H 1239 559 deflated
GREP.CPP 2871 1086 deflated
MAKEFILE 202 137 deflated
MATCH.CPP 15049 4568 deflated
README 10377 3239 deflated
REGX.CPP 1444 599 deflated
REGX.H 777 394 deflated
REGXIMP.H 952 441 deflated
STR.CPP 24315 5293 deflated
STR.DOC 63203 13652 deflated
STR.H 10862 2551 deflated
STRCMP.CPP 1534 598 deflated
STRSEARC.CPP 4188 1013 deflated

Download File STRX.ZIP Here

Contents of the README file

Copyright (c) 1993 by Roy S. Woll

Class "str", Version 2.2 5/16/93

You may distribute and sell any executable which results from using this code
in your applications. You may redistribute this source freely as long as you
leave all files in their original form, including the copyright notice as is.
You may NOT include any SOURCE code of this software with any program that is

I would sincerely welcome any comments/criticism/ideas you might have about
the str or the regular expression class.

If you decide to use this product, you need to register by one of the
following two methods.


You can also register strX directly on Compuserve by going to
the SHAREWARE REGISTRATION section and looking for the product
strX (Registration ID 925)


Register by sending $15.00 to
Roy S. Woll, 1032 Summerplace Dr., San Jose, CA 95122.

By registering you will receive an enhanced version of the class, and
more extensive documentation.


| |
| Roy S. Woll |
| 1032 Summerplace Dr. |
| San Jose, CA 95122 |
| |
| CompuServe : 76207,2541 |
| |
| Phone: (408) 778-2000 x4518 (day) |
| (408) 293-5893 (evening) |
| |

In addition those of you who register will receive a more powerful
version of the regular expression class that includes context-sensitive
regular expressions. For instance you will easily be able to search or
replace a specific portion (flagged by '@') of a regular expression.

regX employeeX("Pay to the order of @[A-Za-z\\s]+$");
str paycheck("Payroll\nPay to the order of Roy S. Woll\n$50,000");
str employee;, &employee);
paycheck.replace(employeeX, "a lucky person");

// After executing the above code, employee will contain the
// name of the person following the text "Pay to the order of ".
// employee = "Roy S. Woll"
// paycheck = "Payroll\nPay to the order of lucky person\n$50,000"



str.doc Documentation file for str class.

str.h Interface file for str class
regX.h Interface file for regular expression class
regXimp.h Interface file used only for implementation of regX
dynstream.h Interface file for dynstream class
bcstr.h Interface file for BCstr class. BCstr is compatible
with the Borland object-based container classes.
It is derived from str.

str.cpp Implementation file for str class
regX.cpp Implementation file for regular expression class
dynstream.cpp Implementation file for dynstream class
match.cpp Regular expression compiling and searching routines
strsearch.cpp Member functions relating to search/replace
bcstr.cpp Implementation file for BCstr class
strcmp.cpp Non-ansi string routines used by str class. Add
this to your library if your system does not have
these (stricmp, strnicmp, strupr, strlwr).

grep.cpp Demo program for "str" class, supporting
file searching of regular expression matches.
Supports wildcard file specifications, case
sensitivity, line numbers, etc.)

makefile This program defines how to build str.lib
readme Brief overview



Type "make" to compile the source and create a library called
str.lib If you wish to place the object files in your own
library, insert the .obj files into your library. You may
also want to place "str.h", and "regular.h" into your default
include path. Bcstr.h is provided for those who wish to use
the Borland object-based container classes to store str's.

If you are using Turbo C++ instead of Borland C++, edit the
makefile and substitute "TCC" for "BCC".

Unix, Vax-Vms, and some other systems may also need to add
strcmp.obj to the library. This module defines non-ansi string
routines used by str class. Add this to your library if your
system does not have these (stricmp, strnicmp, strupr, strlwr).

Type "make grep" to create the executable for grep.
Grep is included as a demonstration program for the str class.
It supports searching of literal and regular expression
within files. Wildcard file specifications, case sensitivity,
line numbers, etc. are all supported. The implementatin uses
only around 1 page of code, which demostrates how natural coding
is when using the regular expression capabilities of the string

If you are upgrading from version 1, then you will need to
recompile all .cpp files that use the str class. This must be
done since str.h has changed. You also will need to change
occurances of pad or strip to use the global versions. This must
be done since the member functions pad and strip now modify their
object. See section "Whats changed in 2.00".

You will need to include , "str.h" in order to use class
str. If you also wish to use regular expressions include
, "regX.h". Header files "dynstream.h" and
"regximp.h" are strictly for implementation. and as such are
separated into other header file. You should never reference them
unless you wish to modify their implementation, or derive a new
class from them.




Fixed substr assignment problem. --> str = substr
Add member function read, lowercase,
uppercase, and variations of pad and strip.


Version 2.1 extends regular expression support to include context
sensitive regular expressions. See section on regular expressions
for more details.

Fix - substr assignment problem. --> str = substr
Fix - case sensitivity problem, member function index was backwards.

WHATS CHANGED IN 2.02 and 2.11
Friend operator >> for reading in strings now directly uses the
string buffer, so as to remove the 256 character limit.

Grep now supports files in other drives and directories.

Optimizations to efficiency in str::_assign which is used
by many str member functions.

Regular expression character sets can now contain octal characters.

Fix - Member function "remove" now transfers only necessary
characters. May have caused Windows application error


This version supports compatibility with Turbo C++. Previous
versions would fail to compile due to Turbo C++'s incorrect
handling of nested classes.


1. Searching and replacing of character strings and regular

2. Case sensitivity now is a property of each instance of str. All
searching and comparing for the str instance automatically
reflects its case sensitivity. During comparisons between two
strings, the case sensitivity of the first argument is used.
Instances of str modify their case sensitivity through member
functions setCaseSensitive(int).

str a=("abcd efgh");
a.setCaseSensitive(0); // a is now case insensitive
str b=("ABCD EFGH");
cout <<"efGH"); // "1" Found
cout <<"efGH"); // "0" Not found

cout << (a==b); // "1" Are equal
cout << (b==a); // "0" Not equal

3. Miscellaneous optimizations and fixes.

Member function iindex is not directly supported. Instead use
member function setCaseSensitive(int) to tell a string instance if
its searching and comparing should be case sensitive or not. The
default is case sensitive.

 December 12, 2017  Add comments

Leave a Reply