![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm having some trouble replacing some text in a text field. Here's the situation. Say I have the following in a text field. filename.1234.xxx I want to change this to filename.abcd.xxx I can use the Replace command without a problem. The issue is that with Replace it counts from the left, and oftentimes the filenames I want to change will be different lengths. What I need to do is start counting from the right. However, when I use RightWords I am able to replace the text as desired, but it returns ONLY the changed text. Here's the script I am using. Replace ( Right ( "1234" ; 7 ) ; 1 ; 4 ; "abcd" ) Obviously there is some boneheaded thing I am doing. Any advice? |
#3
| |||
| |||
|
|
From your description, I am seeing the "filename." and ".xxx" parts as unchanging. If those parts are unchanging, you don't need to count anyting. Just replace your existing value with "filename." & NewName & ".xxx" Where NewName = "abcd" Does that work for you, or am I misunderstanding the problem? |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
On 2005-12-08 15:30:21 -0800, "Matt Wills" <Im (AT) Witz (DOT) End> said: From your description, I am seeing the "filename." and ".xxx" parts as unchanging. If those parts are unchanging, you don't need to count anyting. Just replace your existing value with "filename." & NewName & ".xxx" Where NewName = "abcd" Does that work for you, or am I misunderstanding the problem? Hi Matt. Here's what I mean. In my field I have the name of various files on our server. The files will always have totally different names. Cosider the following examples. ThisIsAFileName.1234.xxx AnotherFileName.1234.xxx INeedAFrostyBeer.1234.xxx MyHeadHurts.1234.xxx The parts of the file name that never change are the last seven characters. So I need to be able to replace the 1234 in these file names with abcd and leave the entire rest of the filename intact. Is there any way to run the Replace function and have it count from the right? Thanks! |
#6
| |||
| |||
|
|
Will the following calculation do the trick, Text being the initial contents of your field. Left(Text;Length(text) - 8) & "abcd," & Right(text;3) |
![]() |
| Thread Tools | |
| Display Modes | |
| |