?
Solved

get 3 character from left

Posted on 2003-12-01
7
Medium Priority
?
229 Views
Last Modified: 2010-04-05
Hi...
does anybody knows how I can get the first 3 character from left of a variable .?

Thanks ^^
0
Comment
Question by:allie910
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 26

Accepted Solution

by:
Russell Libby earned 60 total points
ID: 9855091

result:=Copy(variable, 1, 3)


Regards,
Russell
0
 
LVL 2

Expert Comment

by:TheLeader
ID: 9855104
is this variable string !?
ex:
S,T : String;
T := Copy (Length(S)-3,Length(S))
0
 
LVL 2

Expert Comment

by:TheLeader
ID: 9855111
sorry i thought it from right :p
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:TheLeader
ID: 9855124
you can use as "rllibby"
or if you know about this
S : String;
s[1] :=  "1st char"
S[2] := "2nd char"
S[3] := "3rd char"
 and so on

hope it helped ...
0
 
LVL 7

Expert Comment

by:sftweng
ID: 9855274
Be careful using S[i] rather than Copy - there's trouble if I > Length(s). rllibby's approach is safer.
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 9855287

TheLeader,

You might want to include the check for:

if (length(s) >= required_length) then
begin
  ... // access s[index], ie s[1], s[2], s[3] ...
end;

Just for completness in your example....

Kindest regards,
Russell



0
 
LVL 2

Expert Comment

by:TheLeader
ID: 9855442
yah i know, he must check the length first ofcourse
but i wanted to show him another way.

by the way "rllibby" I didn't see your post til I submit my first comment.
anyway, I get it in reverse :p
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

752 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