Deleting Part of a Name

Experts-

I have this name

<cfset myname = 'ABCSeamlessAlaska15442/GutterProtection/GH/AK (1145)'>

And I want to remove everything after the first '/' including the backslash

any help would be appreciated.
LVL 2
nmaranoAsked:
Who is Participating?
 
_agx_Commented:
If it always contains a "/", treat it as a list:

   <cfset firstPart = listFirst(myName, "/")>

Note, if "myName" doesn't contain a "/", listFirst will just return the whole value.

Edit:

ie    <cfset myName = "ABCSeamlessAlaska15442">
      <cfset firstPart = listFirst(myName, "/")>

Returns:

     ABCSeamlessAlaska15442
0
 
nmaranoAuthor Commented:
agx-  Thanks!  I was treating it that way, but hit a wall on how to only return everything prior to the first '/'  

Will retweak in a minute
0
 
nmaranoAuthor Commented:
Thanks!  I was using the listfind then replacing which was obviously only replacing the "/" and not the rest of the string

Thanks
Nick
0
 
_agx_Commented:
You're welcome. Anytime :)
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.