Normal Topic Need advice on a programming tweak (Read 434 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Need advice on a programming tweak
Jul 12th, 2012 at 7:08pm
Print Post Print Post  
I've had the following bit of code in play in one form or another since my Q&A days:
Code
Select All
DIRECTIONS=@REPLACE(DIRECTIONS," west "," West ")
DIRECTIONS=@REPLACE(DIRECTIONS," east "," East ")
DIRECTIONS=@REPLACE(DIRECTIONS," north "," North ")
DIRECTIONS=@REPLACE(DIRECTIONS," south "," South ")
DIRECTIONS=@REPLACE(DIRECTIONS," main "," Main ")
DIRECTIONS=@REPLACE(DIRECTIONS," st "," St.")
 


My dispatcher pointed out to me an odd effect this was having that we've never noticed before. He was attempting to enter some directions to a Customer's location in the "Directions" field, and was using ALL CAPS because our drivers had not been paying attention.  To his frustration, every time he entered "GO SOUTH ON RTE 1" the text was changing to "GO South ON RTE 1". 

I did some experiments and it looks like my @REPLACE command is changing any version of the word " south ", be it all caps, all lower case, or mixed case, into " South ".  Page 354 of the programming guide offers no help in regards capitalization.  I was sure the double quotes defining the literal string " south " (including the spaces) would change only that LC version, but apparently not.

Any help would be appreciated.
  

**
Captain Infinity
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Need advice on a programming tweak
Reply #1 - Jul 12th, 2012 at 7:34pm
Print Post Print Post  
In all cases, unless otherwise specified, Sesame is case-insensitive. So the search side of @Replace is case insensitive. The replace side of @Replace is "as-is".

You can probably use @RegexReplaceString instead. It has a flag for case-sensitivity.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Need advice on a programming tweak
Reply #2 - Jul 12th, 2012 at 8:19pm
Print Post Print Post  
Thank you, works great.
  

**
Captain Infinity
Back to top
IP Logged