Monday, February 27, 2012

NXT Blocks - String utils - Sub String (GSASubString)

I must confess, I am pretty new with both LEGO and Mindstorms. In searching for a platform to build some of my robot tests I opted for this ingenious kit named LEGO MINDSTORMS® NXT 2.0 [8547].

While trying to write my programs on the LEGO's visual platform I suddenly fall in need of more sophisticated Building Blocks. After a few days of trial and error I found a way to create such of blocks. But there is no joy without sharing no? :)

The first block to share is the GSASubString block from the String manipulation family. This block practically allows us to extract a substring from another string (text).

1. Input String - the source string
2. Offset - the start position of the substring
3. Length - the substring length

1. Substring - the resulting substring

Example usage:

The example returns "bc".

You can download the GSASubString here.

No comments:

Post a Comment