.net - NameSplit = Source.Split(New [Char]() {CChar(Seperator)}) -


can me, im new vb , using code log temperatures via usart microcontroller. have function string in csv format. have difficulty understanding line : namesplit = source.split(new [char]() {cchar(seperator)})

public class form1     'parse text in file per "csv" style ==> (items per record)     public function field(byval source string, byval seperator string, byval index integer) string         dim namesplit string()        'declare nuwe variable waarin         namesplit = source.split(new [char]() {cchar(seperator)})    'vind enige karakter en gryp hom, soek dan n komma wat die sepearotr en split         if index - 1 < 0             field = "index out of range"         else             field = namesplit(index - 1)         end if     end function 

any appreciated.

string.split msdn

returns string array contains substrings in instance delimited elements of specified string or unicode character array.

in case using overload: split(char()): splitting string using character array.

but code converting string argument separator character array. note converts first character in string character array of 1 element.

also note square brackets not required around [char] , in case functionally equivalent to:

namesplit = source.split(cchar(seperator)) 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -