Page 1 of 1 1
Topic Options
#212308 - 2017-02-28 03:48 PM New Replace Function in 4.67
syntax53 Offline
Fresh Scripter

Registered: 2004-11-17
Posts: 33
Loc: Pennsylvania
Why was this not plastered all over the release notes? After updating to 4.67 I was getting a fatal "ERROR : expected FUNCTION name!" in my UDF library. With no line number I had to go through deleting a few functions at a time to finally find the one that was causing the problem. Low and behold it was...

 Code:
FUNCTION Replace($String,$SS,$RS)
    $Replace=Join(Split($String,$SS),$RS)
ENDFUNCTION


After triple checking the code and seeing no issues, I looked all over at the release notes (website, forum, .txt file in the zip) for some hint at what changed. I saw no mention of a new replace function or anything like that. Finally I found it in the "kix2010.doc" in the "What's New" section, "New function to replace characters/strings in strings"


Edited by syntax53 (2017-02-28 03:50 PM)

Top
#212309 - 2017-02-28 04:12 PM Re: New Replace Function in 4.67 [Re: syntax53]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
Replace is not new. Not sure when it was added, but it's been in there for quite a while. I'm thinking since at least 4.60.
Top
#212310 - 2017-02-28 04:25 PM Re: New Replace Function in 4.67 [Re: Allen]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Always a PITA to find something like that especially if it turns out to be something like a "simple" function name. It are always the simple things that are overlooked.

4.61 is the first version with the build-in replace function. New functions with any kind of name can possibly be added in the future. There is no real way to predict what will happen because nobody knows in advance all function names people use in UDFs.

http://www.kixtart.org/forums/ubbthreads...true#Post191701
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#212311 - 2017-02-28 05:40 PM Re: New Replace Function in 4.67 [Re: Mart]
syntax53 Offline
Fresh Scripter

Registered: 2004-11-17
Posts: 33
Loc: Pennsylvania
Weird that it wasn't until 4.67 that it started throwing the error. I was on v4.66 prior.
Top
#212312 - 2017-03-01 03:39 PM Re: New Replace Function in 4.67 [Re: syntax53]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Hmmmm.....strange.
Just did a small test and the code below works fine in 4.66 but throws and error in 4.67. Changing the function name slightly works just fine. Something must have changed compared to 4.66. I'll post something in the BETA section and link here.

 Code:
Break on

$string = "12324252627282920"
$ss = "2"
$rs = "#"

Replace($String, $SS, $RS)

Sleep 10

Function Replace($String, $SS, $RS)
	$Replace = Join(Split($String, $SS), $RS)
EndFunction
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#212611 - 2017-07-27 01:36 PM Re: New Replace Function in 4.67 [Re: Mart]
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
Ah... this is a name conflict (UDF with the same name as a built-in function).
And this was slightly tweaked in 4.67.

I'll see if I can enhance it to throw a more helpful error.

Ruud

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.056 seconds in which 0.023 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org