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"
|