|
|
|||||||
|
There's a slight chance that the first part of the above playground call may not travel well for those that never played marbles at school. But given the average age of the Rev community this is probably not a lot of us.
Anyway a quick "whoops" that hit us recently which with hindsight is obvious but at the time surprised slightly. Consider the following code
string = "'John','','','','','Smith'"
swap ",''," with ",null," in string
if youExpectedTheResultantStringToBe = "'John',null,null,null,null,'Smith'" then
goSub carryOnReading end return carryOnReading: Well of course (if you're here) it wasn't - it was actually "'John',null,'',null,'','Smith'" and now we've pointed that out it will be painfully obvious won't it? The swap command traverses the string left to right looking for comma apostrophe apostrophe comma and replaces it with comma null comma so with the first pass "'John','','','','','Smith'" becomes "'John',null,'','','','Smith'" So swap continues from the last "touched" character +1 (effectively col2() + 1 - or in this case apostrophe (not comma) and looks for the next comma apostrophe apostrophe comma, so with this pass "'John',null,'','','','Smith'" becomes "'John',null,'',null,'','Smith'" So the simple answer? Instead of swapping comma apostrophe apostrophe comma just swap comma apostrophe apostrophe. - so :-
string = "'John','','','','','Smith'"
swap ",''" with ",null" in string Labels: gotcha
Previous Posts
Archives
BlogRoll
Subscribe
Subscribe via RSS
(For those who still appreciate civilised technology.)
Add to your reader
Scan to subscribe
Subscribe to
|
|||||||
| |||||||
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home