Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Manipulating strings using C++Builder

Status
Not open for further replies.

wahmit

Structural
Aug 19, 2003
16
0
0
GB
Hi,

Can anybody tell me how I can access the AnsiString functions in Borlands C++ Builder. Typically

#include <vcl.h>
#pragma hdrstop
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{ AnsiString string2 = LeftStr(&quot;hello world&quot;,5);
return 0;
}

gives the error

&quot;[C++ Error] Project1.cpp(16): E2268 Call to undefined function 'LeftStr' &quot;

I have tried several header files to no avail.

Thanks,
 
Replies continue below

Recommended for you

I don't see a
Code:
LeftStr()
mentionned in the list of methods for AnsiString nor is
Code:
LeftStr()
in the Borland C++ Help Index. The closest function I can think of is &quot;
Code:
AnsiString __fastcall SubString(int index, int count) const;
&quot;
 
Thanks for the reply jrrs, interesting... Looking up LeftStr on my help gives;

---------------------------------------
VCL Reference
LeftStr

Returns the substring of a specified length that appears at the start of a string.

Unit

StrUtils

Category

string handling routines

extern PACKAGE AnsiString__fastcall LeftStr(const AnsiString AText, int ACount);

Description

LeftStr returns the leading characters of AText up to a length of ACount characters. Thus, for example,

LeftStr(&quot;Programmer&quot;, 7)

returns the string

&quot;Program&quot;

-------------------------------------------------
 
Status
Not open for further replies.
Back
Top