Page 1 of 1 1
Topic Options
#80942 - 2002-06-13 05:43 PM VB-type Functions: CLNG, MID, REPLACE
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Ideas..

REF - http://Kixtart.org/board/ultimatebb.php?ubb=get_topic;f=2;t=003474

If we dig back into the MS-Access helpfile, we should also be seeing - CLNG..

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q239104

I know this is not Access, but it would kinda neat to see some of these functions..

Another example, MID..

A cool function we can use from vb is Replace..

Kent

[ 13 June 2002, 17:43: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#80943 - 2003-03-05 07:20 PM Re: VB-type Functions: CLNG, MID, REPLACE
JensKalski Offline
Starting to like KiXtart

Registered: 2000-12-13
Posts: 186
Loc: Germany
REPLACE would be very nice!
_________________________
Jens Kalski

Top
#80944 - 2003-03-05 10:28 PM Re: VB-type Functions: CLNG, MID, REPLACE
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
How about this replace:
code:
function replace($str,$src,$rpl)
$replace=join(split($str,$scr),$rpl)
endfunction



[ 05. March 2003, 22:29: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#80945 - 2003-03-06 09:41 AM Re: VB-type Functions: CLNG, MID, REPLACE
Schuliebug Offline
Hey THIS is FUN
*****

Registered: 2002-01-18
Posts: 379
Loc: Netherlands
sealeopard,

Thats exactly the logic i use to see if a value is in an array:
code:
$_=$ArrayDelim+Join($Array,$ArrayDelim)+$ArrayDelim
If Instr($_,$ArrayDelim+$ValueToLookFor+$ArrayDelim)<>0
; In array !!
EndIf

It seems faster than looping the array... [Smile]

[ 06. March 2003, 09:42: Message edited by: Schuliebug ]
_________________________
Kind regards,

Top
#80946 - 2003-03-06 10:12 AM Re: VB-type Functions: CLNG, MID, REPLACE
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
schulie, what about:
code:
if -1<ascan($array,$searchfor)
"in array"
else
"not in array"
endif

[Wink]
_________________________
!

download KiXnet

Top
#80947 - 2003-03-06 04:46 PM Re: VB-type Functions: CLNG, MID, REPLACE
Schuliebug Offline
Hey THIS is FUN
*****

Registered: 2002-01-18
Posts: 379
Loc: Netherlands
Totally right Lonkero, just a quick way for 4.12 maybe ? Ok ok, should upgrade to 4.20...
_________________________
Kind regards,

Top
#80948 - 2003-03-06 05:14 PM Re: VB-type Functions: CLNG, MID, REPLACE
Lee Wilmott Offline
Starting to like KiXtart

Registered: 2002-09-17
Posts: 106
Loc: Bristol, UK
A Replace() function would absolutely brilliant!

It would be nice to specify how many occurrences of the “text-to-replace” you would like replaced. (and maybe specify -1 to replace all occurrences).

One other thing...I know it is a "very" simple function but a RepeatStr() function would also be very helpful - this UDF appears in so many of my scripts.

Lee

Top
#80949 - 2003-03-06 07:12 PM Re: VB-type Functions: CLNG, MID, REPLACE
JensKalski Offline
Starting to like KiXtart

Registered: 2000-12-13
Posts: 186
Loc: Germany
Hi sealeopard,
it works fine. I doesn't know that join() works with more than one character as delimiter. In the helpfile stands "string character"?!?

Thanks for this workaround.

It would be nice if those little tricks and workaround find a way into the kixhelp.chm.
_________________________
Jens Kalski

Top
#80950 - 2003-03-06 11:45 PM Re: VB-type Functions: CLNG, MID, REPLACE
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
I'll post a formal Replace() UDF later tonight. Stay tuned.
_________________________
There are two types of vessels, submarines and targets.

Top
#80951 - 2003-03-07 03:22 AM Re: VB-type Functions: CLNG, MID, REPLACE
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Actually, there's no need for a new Replace() UDF as there's already one posted in the UDF Forum: Replace() - Replaces first or all occurrences of one string with another
_________________________
There are two types of vessels, submarines and targets.

Top
#80952 - 2003-03-07 08:54 AM Re: VB-type Functions: CLNG, MID, REPLACE
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, what about string limitations?
and speed of functioning?

I think the best way to do replace is just like showed in this topic.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


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

Who's Online
0 registered and 515 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.082 seconds in which 0.054 seconds were spent on a total of 12 queries. Zlib compression enabled.

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