forum-msg-id-128400-edit
Original date:2015-07-23 11:07:15 Edited by: petelomax Subject: Re: Algorithm to Remove An Element Based on Value of Particular Element Position
that looks pretty easy, is there anything wrong with this?
function remove(sequence s, integer idx, object val) object si for i=1 to length(s) do si = s[i] if sequence(si) and idx<=length(si) and equal(si[idx],val) then s = s[1..i-1]&s[i+1..length(s)] exit end if end for return s end function
Edit: oops - replaced equal(si[i],val) with equal(si[idx],val)
Not Categorized, Please Help
|