- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Extract String
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-06-2012
03:02 AM
- last edited on
02-21-2012
03:26 PM
by
Jostein
Hi All,
My input string is BC89RACJ0098457632.
I've to extract the string and to store as like
A=BC
B=89
C=RACJ
D=0098457623
and i've to check, whether A & C is a string and B & D as an integer ?
give some ideas to do this..
Thanks & Regards,
Solved! Go to Solution.
Re: Extract String
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Accept as Solution
- Email to a Friend
- Report Inappropriate Content
01-06-2012 05:06 AM
hope this might help...
StrObject is an Array of string defined at global level
str is a string initially "BC89RACJ0098457632";
resultstr is some fixed array of string.
resultAlpha is some fixed array of string.
FinalResultStringArr is some array of string.
FinalResultNumberArr is some fixed array of integer.
regexAlphabet is some RegularExpression;
regexAlphabet = regularExpression("[0-9]");
regexNumber is some RegularExpression;
regexNumber = regularExpression("[A-Z]");
resultstr = regexAlphabet.split(str);
resultAlpha = regexNumber.split(str);
for each string in resultstr do
{
print(it);
StrObject.append(it);
}
for each string in resultAlpha do
{
print(it);
}
Re: Extract String
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Not the Solution
- Email to a Friend
- Report Inappropriate Content
01-06-2012 06:17 AM
Hi,
You can use Blaze built-in functtion portable().subString() to achieve this.
mainStr = "BC89RACJ0098457632".
a = portable().subString(mainStr, 1,2).
In this case 'a' will have the value as BC
Similarly the values in b,c,d can be achieved as follows:-
b = portable().subString(mainStr,3,4).
c = portable().subString(mainStr,5,8).
d = portable().subString(mainStr,9,18).

