[Gambas-user] An utility component for Gambas

Julio Sanchez jusabejusabe at ...626...
Mon Dec 1 19:26:02 CET 2014


Benoît:

>content = Scan(text, "*<div>*</div>*")
Yes, function as a "simple" between. But would not work with nestings

Example:
  Dim arrayStr As String[]
  Dim text As String

  text = "Hola <div> Bonito <div> gato </div> negro </div>"

  ArrayStr = Scan(text, "*<div>*</div>*")

  Print arrayStr[1]

Return:
"Bonito <div> gato "


If you respect the nesting would return:
"Bonito <div> gato </div> negro "


Regards
Julio

2014-12-01 19:11 GMT+01:00 T Lee Davidson <t.lee.davidson at ...626...>:

> On 12/01/2014 08:48 AM, Benoît Minisini wrote:
> > Hi,
> >
> > I'd like to create a 'gb.util' component, written in Gambas, to collect
> > useful non-GUI programming routines that can't go directly into the
> > interpreter because it would make it too heavy.
> >
> > [snip]
> >
> > The difficulty will be to find the best interface (class name, method
> > name, where to put it) for that.
> >
> > For example, for the removing accents method, I extended the String
> > class. Logical... For directory methods, I created a new Shell static
> > class...
> >
> > [snip]
>
> I'm not sure if you are asking for thoughts on miscellaneous functions
> to put in a gb.Util component or thoughts on useful extensions to
> existing classes, or both. But...
>
> A. Format decimal numbers as octal:
> Public Sub Format(iDecimal as Integer) as String
>    Dim digit as Byte
>    Dim out as String
>    While (iDecimal > 0)
>           digit = iDecimal % 8
>           iDecimal /= 8
>           out = digit & out
>    Wend
>    Return out
> End
>
> B. It would be nice to be able to work with *nix-native timestamps.
> Perhaps this might be relatively easily accomplished by just a couple
> functions:
> 1. DateToTimestamp(dDate as Date) as Integer
> 2. TimestampToDate(iTimestamp as Integer) as Date
> Format$ should be able to take over from there.
>
>
> --
> Lee
> __________
>
> "Artificial Intelligence is no match for natural stupidity."
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&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