Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Most elegant way to extract substring until first SPACE

Status
Not open for further replies.

Delphard

Programmer
Jul 22, 2004
144
RS
This is prosaic task, but I'm interesting for shortest possible code...
 
remember that you must test for space in the string before executing zathras' code

--------------------------------------
What You See Is What You Get
 
would be an expensive way for something simple....

--------------------------------------
What You See Is What You Get
 
@Zathras
That's it!
One comment:
Interesting, same result is get with:
Copy(s,0,Pos(' ',s));
How it's possible? What is String.Index[0]? Maybe length of a string!?

@whosrdaddy
In my case I'm sure that string contains SPACE, but your remark is right.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top