Delete repeated values and get sorted list of valu

The free javascript function can be used to get sorted list after deleting repeated value of string or integers.

Features

  • Give any repeated values in the textarea as string or integer.
  • Just click the Remove Duplicates button.
  • You can have sorted list of strings or numbers without repeated values.
  • Click reset and check it again with any duplicate values.

Preview

Deleting Duplicate values in an array:

Downloads


<!--Script by hscripts.com-->
<!-- Free javascripts @ https://www.hscripts.com -->
<script type="text/javascript">
function delrepeat(mytextarea)
{
var temp=document.txtchk.mytextarea.value;
var array2 = temp.split(" ") ;
var array1= new Array;
for(var i = 0; i < array2.length; i++)
{
var xx = true;
var ArrayVal = array2[i];
for(var j = i+1; j < array2.length; j++)
{
if(array2[j] == ArrayVal)
xx = false;
}if(xx == true)
array1.push(ArrayVal)
}
document.txtchk.mytextarea.value=array1;
}
</script>
<!-- Script by hscripts.com -->
  • Release Date - 20.6.2007
  • Get free version without ©copyright link for just $10/-
  • For customization of this script or any script development, mail to support@hscripts.com

Usage

  • Now just copy the above free JavaScript code in your web page inside the head tag.
  • Create a form with name "txtchk" and place a textbox & call it by name "mytextarea"
  • <form name ="txtchk">
    <input type="text" name="mytextarea" size="30" value="1 2 2 3 3 4 4 5 5 5">
    </form>
  • Create a button with name and call the function delrepeat(mytextarea)by using onclick event.
  • <input type="button" value="Remove Duplicates" onclick="delrepeat(mytextarea)" >
  • Both the button and text area should be in the same form.

License

Related Scripts

Free Javascript Scripts


Ask Questions

Ask Question