Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

find the drive letter in a string

Posted on 2011-09-07
6
Medium Priority
?
377 Views
Last Modified: 2013-12-24
I have a string like this
C:\ColdFusion8\wwwroot\mydocs

how would I find the drive (in this cas "C:")?
0
Comment
Question by:Shawn
  • 3
  • 2
6 Comments
 
LVL 9

Expert Comment

by:AriMc
ID: 36499258
0
 
LVL 1

Author Comment

by:Shawn
ID: 36499365
yep, figured that..just can't remember the syntax

<cfset mystring = "C:\ColdFusion8\wwwroot\mydocs">



left(mystring ???
0
 
LVL 9

Accepted Solution

by:
AriMc earned 2000 total points
ID: 36499404
Does this work:

<cfset mystring = Left("C:\ColdFusion8\wwwroot\mydocs", 2)>

0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 1

Author Closing Comment

by:Shawn
ID: 36499447
yes, thank you
0
 
LVL 52

Expert Comment

by:_agx_
ID: 36500102
Just for future reference, you could also use list functions

     <cfset driveLetter = listFirst(("C:\ColdFusion8\wwwroot\mydocs", "\/")>
0
 
LVL 1

Author Comment

by:Shawn
ID: 36500230
thanks agx. i like it
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Loops Section Overview
Suggested Courses
Course of the Month13 days, 11 hours left to enroll

963 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