find the drive letter in a string

I have a string like this
C:\ColdFusion8\wwwroot\mydocs

how would I find the drive (in this cas "C:")?
LVL 1
ShawnAsked:
Who is Participating?
 
AriMcConnect With a Mentor Commented:
Does this work:

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

0
 
ShawnAuthor Commented:
yep, figured that..just can't remember the syntax

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



left(mystring ???
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
ShawnAuthor Commented:
yes, thank you
0
 
_agx_Commented:
Just for future reference, you could also use list functions

     <cfset driveLetter = listFirst(("C:\ColdFusion8\wwwroot\mydocs", "\/")>
0
 
ShawnAuthor Commented:
thanks agx. i like it
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.