PDA

View Full Version : Need help on parsing a string


Martin_SBT
10-22-2003, 01:46 PM
I am scratching my head with this but i am sure that it will be obvious for one of you:

i have a variable that contains data in the following format:

DOMAIN\USER


I want to retrieve both items, Domain and User, and place each into its own variable. Now the lentgh of "Domain" and "USER" is not always the same so...Anyone can help me out with that?

Thanks in advance

Martin

TJ_Tigger
10-22-2003, 02:23 PM
Not a problem. Since the length is different you can treat it as a delimited string. Use the String.GetDelimited function to get both index 0 and index 1 and use the \ as your delimiter.

%SourceString% = "DOMAIN\USER"
%domain% = String.GetDelimitedString ("%SourceString%", "\", 0)
%user% = String.GetDelimitedString ("%SourceString%", "\", 1)

Corey
10-22-2003, 02:23 PM
Hi Martin. There are a couple ways to approach this, but to keep it simple why not treat it as a tab delimited string which uses \ as the delimiter...

So you would use a STRING > GET DELIMITED STRING action to extract whatever data you need and place it into variable(s) of your choice, i.e. %myItem1%, %myItem2%, %myItem3%, etc...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

Martin_SBT
10-22-2003, 02:28 PM
ahhhhhhhhh! I new it was simple! (for you at least):)

thanks guys

Martin

EDITED BY COREY

Corey
10-22-2003, 03:06 PM
Martin, please be more careful what comments you post here in the AutoPlay Media Studio 4.0 forum, thanks...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)