Can anybody help me with dividing text? I have a SMB share path and I need the
last charters till the first slash from the right side.
example:
Path: smb://myserver.com/dfs/homefolders/username in need the username
The problem is that the username has different lengths and charters. It’s not a fixed pattern.
I know you have to use text delimiters but I don’t know how.
set p to "smb://myserver.com/dfs/homefolders/username"
do shell script "basename " & quoted form of p
-- result: username
-- do shell script "dirname " & quoted form of p
-- result: smb://myserver.com/dfs/homefolders
set p to "smb://myserver.com/dfs/homefolders/username"
set ASTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to "/"
set q to last text item of p
set AppleScript's text item delimiters to ASTID
return q