Can someone point me in the right direction for merging 2 separate strings?
Say I have the following strings:
C:\Users\myuser\department\file.txt
Z:\shared\
And I want to get the following:
Z:\shared\department\file.txt
Essentially I want to find "department" in the first string and append everything from the start of that point to the second string.
Hopefully this makes sense. In vb.net I would just run an InStr() function to return an integer where department starts. Then I could use the Mid() function to extract that exact portion of the string.
Thanks in advance!
Merge two string
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
Use the offset function as equivalent for 'InStr' and a char chunk expression as equivalent for 'Mid'
(edited to fix typo as spotted by Jerry)
Jan Schenkel.
Code: Select all
put "C:\Users\myuser\department\file.txt" into tLocalPath
put "Z:\shared\" into tRemoteDir
put offset("department", tLocalPath) into tOffset
put char tOffset to -1 of tLocalPath into tRelativePath
put tRemoteDir & tRelativePath into tRemotePath
Jan Schenkel.
Last edited by Janschenkel on Thu Jul 02, 2009 9:17 pm, edited 1 time in total.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
Ah, heh, oops... This happens often, as I change my mind about the name of a variable right in the middle of scripting 
Glad to hear you find my posts helpful! I'm sure you'll do the same for others here when you get a chance.
Jan Schenkel.

Glad to hear you find my posts helpful! I'm sure you'll do the same for others here when you get a chance.
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com