[Gambas-user] Another possible change...

Nelson Ferraz nferraz at ...184...
Sun Dec 14 18:18:05 CET 2003


Daniel Campos wrote:

> Is there any function to reverse the contents of an string?
> 
> I mean :
> 
> String A
> String B
> A="hello"
> B=StrReverse(A)
> B="olleh"

It's another interesting idea, but I think it could be implement as a 
string method:

newString = myString.Reverse()

Using Split and Join methods, we could reverse a sentence word by word:

newString = myString.Split(/\s/).Reverse().Join(' ')

The Reverse() method should be applicable to arrays as well.

-- 
[]s

Nelson

________________________________________________________________
Nelson Ferraz

GNU BIS: http://www.gnubis.com.br
PhPerl:  http://www.phperl.com






More information about the User mailing list