jan
(Getting the hang of it)
2004-09-23 03:25 PM
how to cut in a string

Hi,

I have a string:
test1#teste#testesen#dkbirfs01;MF Skrivebord users;MF Orion;dbbpc

I want to cut everything before ";" and then split the rest. After ; there can be serveral ;

Hope I have explained my problem clearly

Jan


LonkeroAdministrator
(KiX Master Guru)
2004-09-23 03:35 PM
Re: how to cut in a string

you mean something like:
split(substr($string,instr($string,";")),";")

or ?


Les
(KiX Master)
2004-09-23 03:35 PM
Re: how to cut in a string

There is more than one ";" so you have not explained well enough for me at least. Maybe others with better clairvoyance understand.

jan
(Getting the hang of it)
2004-09-23 04:02 PM
Re: how to cut in a string

Sorry

I have a script that creates users using a txt-file. I creates users perfectly but when I want to add groups to the users it goes wrong. Everything after ; is groups in my AD the users should be added

Here is part of my code:

$NULL=Open(1,"c:\scripts\users.txt")
$result=ReadLine(1)
$uarray=SPLIT($result,";")
? "uarray: $uarray"
FOR EACH $i IN $uarray
? "FOR i: $i"
; $objuser.memberof="cn="+$i+ "ou=groups,"+ $domain
$objUser.SetInfo
$objUser = ""
NEXT


Richard H.Administrator
(KiX Supporter)
2004-09-23 04:17 PM
Re: how to cut in a string

I'm still not too clear on what you are up to, but if you just want to ignore the first field this should do:
Code:
$NULL=Open(1,"c:\scripts\users.txt")

$result=ReadLine(1)
$uarray=SPLIT($result,";")
$uarray[0]=""
FOR EACH $i IN $uarray
If $i
"FOR i: $i" ?
EndIf
NEXT



jan
(Getting the hang of it)
2004-09-23 04:56 PM
Re: how to cut in a string

Problem solved

Thanks