[PML] What is " nth" mean?

 
  • Excuse me,English is not my native language,so this might be a silly question.

    In [COLOR=#ff0000]STRING object[/COLOR], there is a method "[COLOR=#ff0000][FONT=&]Part(REAL [/FONT][FONT=&]nth[/FONT][FONT=&])[/FONT][/COLOR][COLOR=#000000][FONT=&]",it's purpose says "[/FONT][/COLOR]Extract [COLOR=#000000]nth[/COLOR] field from string where fields are delimited by space, tab or newline. "

    I realize what Part() can do,but[COLOR=#ff0000] I couldn't figure out what the "nth" means and  how use it in this method.[/COLOR]
    Can someone explain for me?

    ps:I see it when trying to understand this codes

    !input= object FILE('C:\AVEVA\Plant\PDMS12.1.SP2\PMLLIB\pml.index')
    !lines= !input.readFile()


    !resultArray= array()


    do !line values !lines
     !columns1= !line.part(1)
     !resultArray.append(!columns1)
    enddo

    !output= object FILE('C:\AVEVA\Plant\PDMS12.1.SP2\PMLLIB\pml-output.txt')
    !output.writeFile('overwrite',!resultArray)
  • "nth" means which part you want to access, it could be "1" for first part, 2 for second part etc. By default it splits on space, so the line in your code above would take the beginning of the line up until the first space character in the line.
    You can also specify which character you want to split on, e.g.

    !columns1 = !line.part(1,'.')

    in case you wanted the part of the line before the first full stop (".").