[eiffel-users] Most common substring pattern

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[eiffel-users] Most common substring pattern

Finnian Reilly
It occurred to me that this is a very common usage of the substring function

local
   s
: STRING
do
   s
:= x.substring (n, x.count)
end

Wouldn't be nice if you could write this instead
local
   s
: STRING
do
   s
:= x.substring_end (n)
end

In the next release of Eiffel-Loop you will be able to do this with the ZSTRING class. And also the equivalent from the start of a string with `substring_start'


--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/group/eiffel-users.
For more options, visit https://groups.google.com/d/optout.
rfo
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: [eiffel-users] Most common substring pattern

rfo
Hi Finnian
 
Try STRING.tail
It's pretty close to what you want 
 
-------- Original Message --------
Subject: [eiffel-users] Most common substring pattern
From: Finnian Reilly <[hidden email]>
Date: Sun, May 28, 2017 1:16 pm
To: Eiffel Users <[hidden email]>

It occurred to me that this is a very common usage of the substring function

local
   s
: STRING
do
   s
:= x.substring (n, x.count)
end

Wouldn't be nice if you could write this instead
local
   s
: STRING
do
   s
:= x.substring_end (n)
end

In the next release of Eiffel-Loop you will be able to do this with the ZSTRING class. And also the equivalent from the start of a string with `substring_start'


--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/group/eiffel-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/group/eiffel-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [eiffel-users] Most common substring pattern

Finnian Reilly
Hi Roger
then I would have to write something like this
local
   s
: STRING
do
   s
:= x.tail (x.count - i + 1)
end

The point of `substring_end' is to make the call to `count' implicit, so `tail' is not any improvement on using `substring'.


--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/group/eiffel-users.
For more options, visit https://groups.google.com/d/optout.
Loading...