Hi,

Not so sure how I should use this UDF?

Using this text in a csv : "whittington","darren"

Hope to get somthing like this: Darren Whittington,dwhittington,group

Darren

code:
  
Break on
At(11,12) "Please enter your source file name (eg. a:\text.csv)?"
gets $source
At(14,12) "Please enter your Group Name?"
gets $group
If open (1, $source) = 0
$sourceline = Readline(1)
WHILE @ERROR = 0
;??? fnCSV2Array ($sourceline)

;Split File

$sourcearray = split ($sourceline,",")

Put in array
For Each $itemofname in $sourcearray
Next

;Arrange output
$fullname= $sourcearray[1]+ " " + $sourcearray[0]
$Username= LEFT($sourcearray[1], 1) + $sourcearray[0]
$lower = Lcase($username)
$username = $lower
IF Open( 3 , "output.txt" , 5 ) = 0
$x = WriteLine( 3 , $fullname + "," + $username + "," + $group + @CRLF)
close (3)
endif
$sourceline = Readline(1)
LOOP
Close (1)
endif

Function fnCSV2Array($s)
Dim $iIndex,$iLength,$cChar,$iMode,$iArraySize
Redim Preserve $fnCSV2Array[0]
$iArraySize=0
$iMode=0 ; 1 = in quoted field

$iLength=Len($s)
For $iIndex = 1 To $iLength
$cChar=SubStr($s,$iIndex,1)
If $iMode
If $cChar='"'
If SubStr($s,$iIndex+1,1)='"'
$fnCSV2Array[$iArraySize]=""+$fnCSV2Array[$iArraySize]+$cChar
$iIndex=$iIndex+1
Else
$iMode=0
EndIf
Else
$fnCSV2Array[$iArraySize]=""+$fnCSV2Array[$iArraySize]+$cChar
EndIf
Else
Select
Case $cChar=','
$iArraySize=$iArraySize+1
Redim Preserve $fnCSV2Array[$iArraySize]
Case $cChar='"'
$iMode=1
Case "true"
$fnCSV2Array[$iArraySize]=""+$fnCSV2Array[$iArraySize]+$cChar
EndSelect
EndIf
Next
EndFunction

_________________________
I want to share something with you - the three sentences that will get you through life.
Number 1, 'cover for me.'
Number 2, 'oh, good idea, boss.'
Number 3, 'it was like that when I got here'.