Posted: Wed Aug 25, 2010 1:39 pm Post subject: Convert String into an Array of Charaters?
Apprentice
Joined: 11 Jun 2009 Posts: 37
Hi community,
I need to a way evaluate the individual characters in a string in ESQL.
For example:
Code:
DECLARE myMsg CHARACTER 'Some Message Value';
WHILE i < size THEN
IF myMsg[i] = 'M' THEN
-- do something
END IF;
SET i = i +1;
END WHILE;
So I suppose what I am looking for is a way to treat a string
like an array of characters.
Please note this is a completely watered down example and is in
no way my actual example .. but the idea is still the same .. that is
I do have a message that I want to evaluate on a character by
character basis.
Again this is an ESQL compute node not a Java Compute node.
You could use SUBSTRING to produce a ROW of individual characters.
But you're probably better off using SUBSTRING to extract the actual pieces you need, like SUBSTRING(string from i for 1)
Or construct a string that matches the full set of conditions you need to test against - like if you need to find out if char[1] is 'q' and char[2] is 'B', then test if the string is equal to 'qB'.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum