Solved

get 3 character from left

Posted on 2003-12-01
7
221 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
  • 4
  • 2
7 Comments
 
LVL 26

Accepted Solution

by:
Russell Libby earned 20 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 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

21 Experts available now in Live!

Get 1:1 Help Now