![]() |
![]() |
||||||
|
|||||||
| Tags: function, split, string |
![]() |
|
|||
|
I'm trying to find a string split function but can't seem to find one.
I'm trying to retrieve just the filename from a path ..... for example: D:\CFusionMX7\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp\neotmp40892 ..tmp I want to retrieve only the "neotmp40892.tmp" so I can save that to a variable. |
| Sponsored Links |
|
|||
|
On Jul 24, 2:36 pm, "dmorand17" <webforumsu...@macromedia.com> wrote:
> I'm trying to find a string split function but can't seem to find one. > > I'm trying to retrieve just the filename from a path ..... for example: > > D:\CFusionMX7\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp\neotmp40892 > .tmp > > I want to retrieve only the "neotmp40892.tmp" so I can save that to a variable. GetFileFromPath()? Or ListGetAt()? (see CF docs) |
|
|||
|
Hi
As dan rightly said you use listlast function as explained below. <cfset filename="D:\CFusionMX7\runtime\servers\coldfusion \SERVER-INF\temp\wwwroot-tmp\n eotmp40892.tmp"> <cfoutput> #listlast(filename,"\")# </cfoutput> Thanks, Satheesh. |
|
|||
|
On Jul 24, 9:36*am, "dmorand17" <webforumsu...@macromedia.com> wrote:
> I'm trying to find a string split function but can't seem to find one. * > > *I'm trying to retrieve just the filename from a path ..... for example: > > D:\CFusionMX7\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp\neotmp40892 > .tmp > > *I want to retrieve only the "neotmp40892.tmp" so I can save that to a variable. While what you want is the getFileFromPathFunction() or listLast functions, since CF is built on J2EE you also have native access to a lot of the Java functions. ColdFusion strings are Java Strings internally, which means they are an Object of class “java.lang.String” . So you can use the string object functions including the split method as in foo.split(). For instance, arrSplit = myStr.split("i"); will return an array (split by the letter 'i'). hth, larry |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise