Re: [Gambas-user] Convert string to integer array

2016-12-24 Thread adamn...@gmail.com
On Sat, 24 Dec 2016 11:05:00 +0100 Benoît Minisini wrote: > Le 24/12/2016 à 09:44, Fabien Bodard a écrit : > > Public Sub Main() > > > > Dim s As String > > Dim i As String > > Dim a As New Integer[] > > ''1) with no knowledge of the number of values > > 'init the string > > s = "[12,

Re: [Gambas-user] Convert string to integer array

2016-12-24 Thread Casper
An elegant solution, one just has to love the Gambas language! a.Add(i) is the part I overlooked, it takes a while to change one's old habits. To all, have a Great Christmas. In this part of South Africa there is a heatwave with temperatures into the high thirties for Christmas. On 24/12/2016, B

Re: [Gambas-user] Convert string to integer array

2016-12-24 Thread Benoît Minisini
Le 24/12/2016 à 09:44, Fabien Bodard a écrit : > Public Sub Main() > > Dim s As String > Dim i As String > Dim a As New Integer[] > ''1) with no knowledge of the number of values > 'init the string > s = "[12,32,3]" > > 'remove unused spaces and braquets > For Each i In Split(Left(R

Re: [Gambas-user] Convert string to integer array

2016-12-24 Thread Fabien Bodard
Public Sub Main() Dim s As String Dim i As String Dim a As New Integer[] ''1) with no knowledge of the number of values 'init the string s = "[12,32,3]" 'remove unused spaces and braquets For Each i In Split(Left(Right(Trim(s), -1), -1)) a.Add(i) Next 'display the arr

[Gambas-user] Convert string to integer array

2016-12-23 Thread adamn...@gmail.com
Baffled! I have a string, like "[1,3]", that I want to populate an integer array from. How to? tia -- B Bruen -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based develop

Re: [Gambas-user] Convert string to integer

2014-01-27 Thread Ru Vuott
..try: qrg_i = CInteger(Val(qrg)) Lun 27/1/14, Dirk ha scritto: Oggetto: Re: [Gambas-user] Convert string to integer A: gambas-user@lists.sourceforge.net Data: Lunedì 27 gennaio 2014, 18:11 Hi, I'm having a problem with Co

Re: [Gambas-user] Convert string to integer

2014-01-27 Thread Caveat
You can't use CInteger on a String that does not represent an Integer! Either make sure your String is always a 'pure' integer... so "14160" in place of "14160.0" Or code qrg_i = Int(CFloat(qrg)), which is much more forgiving. The reason you get an error is that you make the same mistake twice.

Re: [Gambas-user] Convert string to integer

2014-01-27 Thread Dirk
Hi, I'm having a problem with Convert string to integer Public Sub MySock_Read() ' Data via Telnet ' When some data arrives from the remote ' part of the socket, "DataAvailable" event ' is raised ' Dim qrg_i As Integer Dim qrg As String Dim rx,

Re: [Gambas-user] Convert string to integer

2014-01-25 Thread Caveat
What is in qrg at the time you try to do the CInteger call? Kind regards, Caveat On 26/01/14 08:35, Dirk wrote: > Hi, > > I'm having a problem with Convert string to integer > > > where is my mistake? I get error message: > Type incompatibility expected integer, instead get string > > > Public Su

Re: [Gambas-user] Convert string to integer

2014-01-25 Thread Bruce
On Sun, 2014-01-26 at 08:35 +0100, Dirk wrote: > Hi, > > I'm having a problem with Convert string to integer > > > where is my mistake? I get error message: > Type incompatibility expected integer, instead get string > > > Public Sub MySock_Read() > > '***

[Gambas-user] Convert string to integer

2014-01-25 Thread Dirk
Hi, I'm having a problem with Convert string to integer where is my mistake? I get error message: Type incompatibility expected integer, instead get string Public Sub MySock_Read() ' ''*

Re: [Gambas-user] Convert string to integer with arbitrary base

2012-01-20 Thread Caveat
Hi Tobias I'm sorry if I haven't completely understood your request (perhaps you're asking Benoit for a function built in to Gambas?) but I have here some code I wrote to help me do arbitrary conversions of a number in any base to any other base (well up to base 36 anyway... then I ran out of digi

Re: [Gambas-user] Convert string to integer with arbitrary base

2012-01-20 Thread tobias
oops, make this comma in the for loop head a semicolon... > /* >* STR: I string containing symbols >* AL: I alphabet to put symbols in order >* RET: O result in integer format >* return value: O number of symbols put into the integer >*/ > char stoi_

[Gambas-user] Convert string to integer with arbitrary base

2012-01-20 Thread tobias
hi, i haven't found any function to convert a string to an integer with this string containing signs of an arbitrary number base. won't it be useful? this is a piece of code i once wrote for this purpose in c: /* * STR: I string containing symbols * AL: I alphabet to put s