[Gambas-user] Reading the return from a shell command

Rob sourceforge-raindog2 at ...94...
Fri Jan 21 17:48:29 CET 2005


On Friday 21 January 2005 11:37, Dave sharples wrote:
> I think you misinterpreted my original post, I had found
>  your code as you say in the HELP, the problem I am having is
> that I can get the 'return' but I need seperate it so that I
> only have the first word of the returned string.
> e.g return = "CAT DOG MOUSE"
> I need to manipulate that so that I just have CAT
> Does that make sense ?

Oh, sure.

dim sa as new String[]
...
sa = split("CAT DOG MOUSE", " ")
print sa[0]

> CAT

Or if you want to do it more like the VB way...

dim s as String
...
s = left("CAT DOG MOUSE", instr("CAT DOG MOUSE", " ") - 1)
print s

> CAT

Rob






More information about the User mailing list