G
Glenn
[Note: parts of this message were removed to make it a legal post.]
Hi,
I'm looking for a method for the String class that returns an array of strings based on two input strings.
For example, if you had the string 'xxxxxa1byyyyya2bzzzzzzz' I'd like it to return the smaller strings between 'a' and b', but I don't want the smaller strings to include either 'a' or 'b'.
So, 'xxxxxa1byyyyya2bzzzzzzz'.method_x('a', 'b') would return ["1", "2"].
If you had the string 'a1b2' and tried 'a1b2'.method_x('a', 'c') you'd get nil because 'c' is obviously not in the String that's calling the method.
Likewise, if you tried 'a1b2'.method_x('b', 'a') it would also return nil since there's no string between 'b' and 'a' (so the order matters).
I looked but didn't see anything quite like this.
Thanks!
Glenn
Hi,
I'm looking for a method for the String class that returns an array of strings based on two input strings.
For example, if you had the string 'xxxxxa1byyyyya2bzzzzzzz' I'd like it to return the smaller strings between 'a' and b', but I don't want the smaller strings to include either 'a' or 'b'.
So, 'xxxxxa1byyyyya2bzzzzzzz'.method_x('a', 'b') would return ["1", "2"].
If you had the string 'a1b2' and tried 'a1b2'.method_x('a', 'c') you'd get nil because 'c' is obviously not in the String that's calling the method.
Likewise, if you tried 'a1b2'.method_x('b', 'a') it would also return nil since there's no string between 'b' and 'a' (so the order matters).
I looked but didn't see anything quite like this.
Thanks!
Glenn