Index

DKString

Purpose:

This class holds a string. It is frequently used for string handling in EIP.

Do not use instances DKString in STDIN, SDTOUT, or STDERR operations.

Class summary:

 class DKString
{ 
 DKString();
 DKString(const char* s);
 DKString(const DKString &s);
 DKString(void *pBuffer, unsigned long lenBuffer);
 DKString(char * pc);
 DKString(char c);
 DKString(int v);
 DKString(unsigned int v);
 DKString(short v);
 DKString(long v);
 DKString(unsigned short v);
 DKString(unsigned long v);
 DKString(double v);
 virtual ~DKString();
 
 const DKString  operator = (const DKString &cst) const;
 const DKString  operator = (const CString &cst) const;
 const DKString  operator = (const char * cst) const;
 const DKString  operator = (const char c) const;
 const DKString  operator + (const DKString &cst) const;
 const DKString  operator + (const CString &cst) const;
 const DKString  operator + (const char * cst) const;
 const DKString  operator + (const char c) const;
 const DKString  operator += (const DKString &cst) const;
 const DKString  operator += (const CString &cst) const;
 const DKString  operator += (const char * cst) const;
 const DKString  operator += (const char c) const;
 
 DKBoolean operator==(char *s) const;
 DKBoolean operator==(const char *s) const;
 DKBoolean operator==(const DKString &s) const;
 
 DKBoolean operator!=(char *s) const;
 DKBoolean operator!=(const char *s) const;
 DKBoolean operator!=(const DKString &s) const;
 unsigned long size() const;
 DKString subString(unsigned long pos, unsigned long len) const;
 
 void strip();
 unsigned long length() const;
 unsigned long indexOf(char ch) const;
 unsigned long indexOf(const DKString str, unsigned long cpos) const;
 unsigned long indexOf(char ch, unsigned long cpos) const;
 DKString& remove(unsigned long cpos, unsigned long len);
 DKString& insert(const DKString& str, unsigned long cpos);
 DKString& leftJustify(unsigned long len);
 DKBoolean isDigits();
 long asInt();
 unsigned long asUnsigned();
 operator CString();
 operator char *();
 char operator []( unsigned long nIndex );
 DKString& upperCase();
};

Members:

Constructors and destructor
DKString has a series of constructors, which take different arguments to create the string.

The destructor destroys the string.

 
DKDatastoreFed dsFed;
try { 
   dsFed.connect(libsrv,userid,pw);
   DKString dsName   = dsFed.datastoreName();
...
 

Member functions

operators
DKString includes the definition of the operators that you can use with DKStrings.

size
Returns the length of the string.

subString
Returns a DKString that contains a substring of the original DKString. You specify the position of the beginning of the substring and the length.

strip
Strips leading and trailing blanks from the string.

length
Returns the length of the string.

indexOf
Returns the position of the argument in the string. You can find the position of a character or string within the DKString instance and can search from a specific position in the string.

remove
Returns a string with the portion of the original string starting at a position for a length of characters removed.

insert
Returns a string with the specified string inserted at the specified position.

leftJustify
Returns the sting left justified, with padding spaces at the right up to the specified length.

isDigits
Returns true if the string is composed of decimal digits; otherwise, it returns false.

asInt
Returns the signed integer respresntation of the string.

asUnsigned
Returns the unsigned integer representation of the string.

uppercase
Returns the string in uppercase letters.

(c) Copyright International Business Machines Corporation 1996, 2003. IBM Corp. All rights reserved.