Sign in to follow this  
Followers 0
hot202

StringSplit help

4 posts in this topic

#1 ·  Posted (edited)

hi if i had something like this

D:\something\JustShow this.exe

how would i use StringSplit to just show what is after the last \ but it wont always be that long or it could be longer like.

D:\something\something\something\JustShow this.exe

i tryed to work it out but i couldnt get it to show the text after the last\ i could only do it if it was always the same amount of \

Edited by hot202

Share this post


Link to post
Share on other sites



Hi, try this....

#include <array.au3>   ;only to show the array

$path="D:\something\JustShow this.exe"
$Array = stringSplit($path,"\",3)
_ArrayDisplay($Array, "StringSplit()")
msgbox(0,0,$Array[ubound($array)-1])
if you need some more parts of a path-string, the 
_pathsplit()
would be an option

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi,

is this the goal:

MsgBox (0,"", _mysplit ("D:\something\something\something\JustShow this.exe"))
MsgBox (0,"", _mysplit ("D:\something\JustShow this.exe"))

Func _mysplit ($string)
    $temp = StringSplit ($string, "\")
    Return $temp [Ubound ($temp) - 1]
EndFunc

;-))

Stefan

@Edit: To slow......

Edited by 99ojo

Share this post


Link to post
Share on other sites

thanks so much!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0