[Gambas-user] casting or changing datatype.
johnf
jfabiani at ...1109...
Sat Jan 14 07:45:41 CET 2006
Actually I'm trying to figure a way to write a function that I pass a string
to and have it return a result datatype with the name of the string that I
passed.
John
On Friday 13 January 2006 20:42, nando wrote:
> I believe that you are looking for is Variant
>
> Public Function myResult (thestr as String) as Variant
>
> if thestr = "Hello" then Return 0 'This is a integer
> if thestr = "Bye" then Return "Daytime" 'This is a String
> if thestr = "PI" then Return 13.14159 'This is floating
>
> END
>
> -Fernando
>
> ---------- Original Message -----------
> From: johnf <jfabiani at ...1109...>
> To: gambas-user at lists.sourceforge.net
> Sent: Fri, 13 Jan 2006 18:10:09 -0800
> Subject: [Gambas-user] casting or changing datatype.
>
> > Hi,
> > I wonder if it is possible to pass a string to a method and have the
> > string used to for the name of a different datatype.
> >
> > dim passStr As String
> >
> > passStr = "custData"
> > myresult(passStr)
> >
> > public sub myResult( thestr as String) as Result
> >
> > dim thestr as Result
> >
> > return Result
> > end
> >
> > John
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> > files for problems? Stop! Download the new AJAX search engine that
> > makes searching your log files as easy as surfing the web. DOWNLOAD
> > SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>
> ------- End of Original Message -------
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> 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