[Gambas-user] Get one line from text

Fabien Bodard gambas.fr at ...626...
Sun Aug 18 15:13:29 CEST 2013


Le 17 août 2013 23:29, "Kende Krisztián" <nemh at ...2007...> a écrit :
>
> > Hi all.
> >
> > I need your help.
> > I cant get one line from text.
> >
> > My text is:
> >
> >
> > #!/usr/bin/env xdg-open
> >
> > [Desktop Entry]
> > Version=1.0
> > Type=Application
> > Terminal=false
> > Name[uk_UA]=Грибоїд
> > Exec=/Games/Kids/Грибоєд/Griboed_exec
> > Icon=/Games/Kids/Грибоєд/1857.png
> > Comment[uk_UA]=Грибоїд
> > Name=Грибоїд
> > Comment=Грибоїд
> > Encoding=UTF-8
> >
> >
> >
> >
> > How can I get string:
> > "Icon=/Games/Kids/Грибоєд/1857.png"
> >
> > Thanks.
> >
>
> Dim ofile As File
> Dim cline As String
>
> ofile = Open "/path/filename.desktop" For Read
> While Not Eof(ofile)
>   Line Input #ofile, cline
>
>   If InStr(cline, "Icon=") = 1 Then Print Right(cline, -5)
>
> Wend
> Close #ofile
>
Dim sline as string

For each sline in split(file.load("/path/filename..."),"\n")
If trim(sLine) begins "Icon=" then
Print scan(sLine, "*=*")[1]
Endif
Next

>
------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite!
> It's a free troubleshooting tool designed for production.
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
>
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user



More information about the User mailing list