Just to be clear, I can't use foreach():

foreach( <var> IN LISTS <list> )

I am doing a "yielded" approach to looping by using list( GET ) and
list( LENGTH ) in combination. So I would need the list() functions to
acknowledge empty elements.

On Tue, Aug 6, 2013 at 3:04 PM, Robert Dailey <rcdailey.li...@gmail.com> wrote:
> I've seen that list(LENGTH) will ignore empty elements in a list. Example:
>
> 1;2;;4;5
>
> Length will be 4 here instead of 5. I was trying to come up with a way
> to modify the list as a string prior to iterating it to give empty
> elements some dummy value, so that the above example would appear as:
>
> 1;2;<empty>;4;5
>
> However, this isn't going to work with string( REGEX REPLACE ) as the
> modifications are not included in the continuation of the regex search
> (I think positive lookbehind is needed here?). Basically this case
> cannot be converted:
>
> ;;;
>
> to:
>
> <empty>;<empty>;<empty>
>
> Anyone know how I can iterate empty elements in a list?
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to