K kirkm Registered User. Local time Tomorrow, 05:33 Joined Oct 30, 2008 Messages 1,257 Feb 19, 2021 #1 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 ?
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 ?
bob fitz AWF VIP Local time Today, 18:33 Joined May 23, 2011 Messages 4,808 Feb 19, 2021 #2 Where are you using the expression? What is the data type of Dat? Show us an example of the data in Dat
Where are you using the expression? What is the data type of Dat? Show us an example of the data in Dat
C CJ_London Super Moderator Staff member Local time Today, 18:33 Joined Feb 19, 2013 Messages 17,704 Feb 19, 2021 #3 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
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
Cronk Registered User. Local time Tomorrow, 03:33 Joined Jul 4, 2013 Messages 2,800 Feb 19, 2021 #4 CJ, a typo, That should be (according to #1) ?replace("123 - 456 -789"," - ","\",1,1) 123\456 -789
C CJ_London Super Moderator Staff member Local time Today, 18:33 Joined Feb 19, 2013 Messages 17,704 Feb 19, 2021 #5 oops too early in the morning
Isaac Lifelong Learner Local time Today, 10:33 Joined Mar 14, 2017 Messages 11,702 Feb 19, 2021 #6 CJ_London said: 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 Click to expand... +1 on my end it also works as expected, only replaces the first instance of -
CJ_London said: 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 Click to expand... +1 on my end it also works as expected, only replaces the first instance of -
Gasman Enthusiastic Amateur Local time Today, 18:33 Joined Sep 21, 2011 Messages 17,355 Feb 19, 2021 #7 kirkm said: 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 ? Click to expand... Are you running it twice by accident?
kirkm said: 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 ? Click to expand... Are you running it twice by accident?