INFO
Applies To:
ITScriptNet V1/V2
A string containing multiple pieces of data uses multiple characters to seperate each field of data. These fields cannot be cleanly parsed using the Split or SplitN functions. Both of these functions only accept 1 character as the field (data) seperator, so the additional, unwanted characters will be part of the data parsed out of the string.
DETAILS
Use the Replace function with the Split or SplitN function to remove the extra unwanted characters before splitting the string. It is recommended to handle this by using the Replace function to replace the chracters seperating each piece of data with a single character. It is very important the replacement character can never a valid character in any of the data fields stored within the string.
For example, data which has both Carriage-Return
and Line-Feed characters can only be spilt on one of the character which will leave the other character as part of the data which may not display correctly on your terminal. The following Example shows how to Replace characters with a character and then split the string on the character.
;REPLACE WITH
@Temp@ = Replace("12345",ascCR & ascLF, ascCR, 0)
;SPLIT @TEMP@ ON REMAINING CHARACTER
Split(@Temp@, ascCR, @Result1@, @Result2@, @Result3@, @Result4@, @Result5@)
@Result1@ = "1"
@Result2@ = "2"
@Result3@ = "3"
@Result4@ = "4"
@Result5@ = "5"
This article last updated:
1/1/2009 12:00:00 AM