ezzetabi Posted September 7, 2004 Posted September 7, 2004 (edited) I had to split a list using a char before and a char just after. So I made this UDF, hoping that is useful to someone I'll post it here. Example of a list that need DoubleSplit: name=value;name2=value2;name3=name3;name4=value4;name5=value5;namen=valuen Having an array with names and an array with values is very easy with DoubleSplit: $l = 'name=value;name2=value2;name3=value3' $l = _DoubleSplit($l,';','=') $l = StringSplit($l,@cr) $names = StringSplit($l[1],@lf) $values = StringSplit($l[2],@lf) Exit Func _DoubleSplit($LIST, $FCHAR, $SCHAR) Local $C, $STR, $FLIST, $SLIST $STR = StringSplit($LIST, $FCHAR) For $C = 1 To $STR[0] $FLIST = StringTrimLeft($STR[$C], StringInStr($STR[$C], $SCHAR)) & @LF & $FLIST $SLIST = StringLeft($STR[$C], StringInStr($STR[$C], $SCHAR) - 1) & @LF & $SLIST Next $FLIST = StringTrimRight($FLIST, 1) $SLIST = StringTrimRight($SLIST, 1) Return $SLIST & @CR & $FLIST EndFunc ;==>_DoubleSplit Edited September 7, 2004 by ezzetabi
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now