Solved

Equavelent to xBase SUBSTR() function?

Posted on 1998-05-05
2
510 Views
Last Modified: 2010-04-06
I hate to post these no-brainer questions, but I find the Delphi help to be less than helpful.  For instance, I see no listing of built in functions anywhere, and there are rarely an examples in the Help files...

What I am trying to do is so utterly simple.  Here the way it would be in xBase:

MyVar := "MARY"
SecondPos = SUBSTR(MyVar,2,1)          && SecondPos now contains "A"

Thanks...  



0
Comment
Question by:roncm
2 Comments
 
LVL 5

Accepted Solution

by:
ronit051397 earned 50 total points
ID: 1341475
Use the Copy function. From Delphi Help file:

Copy returns a substring of a string.

Unit

System

Category

string handling routines

function Copy(S: string; Index, Count: Integer): string;

Description

The Copy function returns a substring of a string.
S is a string-type expression. Index and Count are integer-type expressions. Copy returns a string containing Count characters starting at S[Index].
If Index is larger than the length of S, Copy returns an empty string.
If Count specifies more characters than are available, the only the characters from S[Index] to the end of S are returned.

Example:

 var S: string;

begin
  S := 'ABCDEF';
  S := Copy(S, 2, 3);      { 'BCD' }
end;
0
 

Author Comment

by:roncm
ID: 1341476
Thanks, Ron, I never would have though to look under COPY()...

With the help of this forum, I just might be able to finish this project...:)

0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now