# Brain bender - remove parts of string and compare against others

**URL:** <https://forum.kirupa.com/t/brain-bender-remove-parts-of-string-and-compare-against-others/173070>\
**Category:** Uncategorized\
**Created:** [December 20, 2005, 10:22pm UTC](https://forum.kirupa.com/t/brain-bender-remove-parts-of-string-and-compare-against-others/173070 "2005-12-20T22:22:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![benswift](https://avatars.discourse-cdn.com/v4/letter/b/b4bc9f/32.png) [@benswift](https://forum.kirupa.com/u/benswift)\
**Post date:** [December 20, 2005, 10:22pm UTC](https://forum.kirupa.com/t/brain-bender-remove-parts-of-string-and-compare-against-others/173070/1 "2005-12-20T22:22:05Z")

</div>

basically i’m trying to remove everything after a “.” in a string  
then compare it to the previous string value  
if they are the same- skip adding it to a list

check the code:

```auto

var prev_splitload = "";
for (var i=0; i<filelist.length;i++){
			my_str = filelist*;
			splitload = my_str.split(".",1);
			if (splitload != prev_splitload){
				loadlist.addItem(splitload, this.baseurl + splitload);
				prev_splitload = splitload;
			
			}else{
			trace("skip");
			}

```

the thing that is NOT working for me now is the comparison part- the part of removing is fine.

if this is the wrong way- all I want to do is avoid having duplicates of the value “splitload”

thanks
