Replace

kirkm

Registered User.
Local time
Tomorrow, 07:10
Joined
Oct 30, 2008
Messages
1,257
This is not working as expected

= Replace(Dat, " - ", "\", 1, 1)


I expected the first instance in Dat of " - " to be replaced with "\". But it replaces 2 instances.
What exactly does the ,1,1 do ?
 
Where are you using the expression?
What is the data type of Dat?
Show us an example of the data in Dat
 
the first 1 is the start position the second is the number of substitutions, so I would expect it to work

?replace("123 - 456 -789"," - ",1,1)
1231456 -789

perhaps show some example data and the result
 
CJ, a typo, That should be (according to #1)
?replace("123 - 456 -789"," - ","\",1,1)
123\456 -789
 
the first 1 is the start position the second is the number of substitutions, so I would expect it to work

?replace("123 - 456 -789"," - ",1,1)
1231456 -789

perhaps show some example data and the result
+1 on my end it also works as expected, only replaces the first instance of -
 
This is not working as expected

= Replace(Dat, " - ", "\", 1, 1)


I expected the first instance in Dat of " - " to be replaced with "\". But it replaces 2 instances.
What exactly does the ,1,1 do ?
Are you running it twice by accident?
 

Users who are viewing this thread

Back
Top Bottom