Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Development-process how to replace the values

Have Programming Question? Ask it here!
 
 
 


nani
how to replace the values
1 Answer(s)      5 years and 10 months ago
Posted in : Development process



Advertisement
View Answers

November 20, 2008 at 3:54 AM


Hi friend,


Code to solve the problem :

import java.util.*;
class ArrayList2
{
public static void main(String[] args)
{
ArrayList al = new ArrayList();
al.add("or");
al.add("c1");
al.add("or");
al.add("c2");
al.add("c3");
al.add("or");
al.add("c4");
System.out.println(al);

String temp = "";

for(int i=0;i<al.size();i++)
{

for(int j=i;j<al.size();j++)
{
if(al.get(i).equals("or"))
{
temp = al.get(i).toString();
al.set(i,al.get(j));
al.set(j,temp);
}

}
}
System.out.println(al);

}
}


Thanks


Related Tutorials/Questions & Answers:
how to replace the values - Development process
how to replace the values  i have arraylist containing "or","c1","or","c2","c3","or",c4" i want the output as "c1","c2","c3","c4","or","or"  Hi friend, Code to solve the problem : import java.util.*; class
PHP Array Replace
PHP Array Replace Sometimes we have to replace array values with given values, PHP provides array_replace() function to replace the values. array_replace... description of array_replace() is:  General Format array array
Advertisements
Replace
Replace   Hi, I have two text files in two diff locatons.The text file like below using java program 1)a.txt 1 abc bangalore 2 def adfsdf 3 ghij asdfdsad 2)b.txt A B C Now i want output is like below
how to set the values in jsp
how to set the values in jsp  how to set the values text boxs in jsp frm dbase via servlet
how to find a dynamic string in a string & how to replace tgat wth with another string - JSP-Servlet
how to find a dynamic string in a string & how to replace tgat wth with another string  Dear sir, i have a ArrayList in that i have stored a values from a excel sheet specified column values and i have one string
ereg_replace() and eregi_replace().
ereg_replace() and eregi_replace().  What is the difference between eregreplace() and eregireplace()?   Hi friends, ereg_replace() is case sensitive like "Bharat"cannot be treated as "bharat"and eregi_replace
PHP Array Replace Recursive
_replace_recursive() replaces the values of first array with the same values from... array, value of the second array will replace the values of first array. If a key...PHP Array Replace Recursive: PHP provides array_replace_recursive() function
MySql find and replace string
MySql find and replace string  How to find and replace string or special characters in MySql & PHP?   Find and Replace String PHP $result = preg_replace('/\band\b/i', 'foo', $subject
How to replace a head into another head
How to replace a head into another head. Get ready to learn a simple... face also. Here, I am going to replace a "Cow" head by a ".... Make Selection: Select which part you want to replace by the Polygonal Lasso
how to insert a summary values in grid
how to insert a summary values in grid  how to insert a summary value in grid
How to get a values - JSP-Servlet
How to get a values  Dear sir, I have one input text field and one submit button .Within one file how to get a values within a same jsp. Thanks and Regards Harini Veerapur.  Hi Friend, Try the following
Replace TEXT
Replace TEXT   I have two text files in two diff locatons.The text file like below using java program 1)a.txt 1 abc bangalore 2 def adfsdf 3 ghij asdfdsad 2)b.txt A B C Now i want output is like below
How to get a values - JSP-Servlet
getting a null value aprt from a attachmented file,so how to get a other values...How to get a values  Dear sir, I have a one form with a multipart/form-data as follows To From Subject
How can I get query string values in JavaScript?
How can I get query string values in JavaScript?  How can I get query string values in JavaScript?   To get a query string value, you can...) { name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regex
Replace JSF Standard Error Message
Replace JSF Standard Error Message  How can we replace the JSF Standard Error Message
Java String : Replace All
Java String : Replace All This section defines how to replace all character with specified character without using system methods. Replace All method : You can replace all specific character in a given string with another character
How to show database values into graph using jsp?
How to show database values into graph using jsp?  How to show database values into graph using jsp
How to show database values into graph using jsp?
How to show database values into graph using jsp?  How to show database values into graph using jsp
how to read values from java in xml?
how to read values from java in xml?  how to read values from java in xml
What is the difference between ereg_replace() and eregi_replace()?
What is the difference between ereg_replace() and eregi_replace()?  What is the difference between eregreplace() and eregireplace
replace character in php
replace character in php  PHP script that replace character
How to get the request scope values? - Struts
How to get the request scope values?  Get value in Struts
how to insert values from jsp into ms access
how to insert values from jsp into ms access   how to insert values using jsp into ms access database
find and replace in java
find and replace in java  Need 'find and replace' function in Java to find special keyword in XMl such as @,#,!,%..and replace with their corresponding entities
Use of <fn:replace(String, String, String)> Tag of JSTL
Use of <fn:replace(String, String, String)> Tag of JSTL... will learn how to use <fn:replace> Tag of JSTL. This tag returns... : java.lang.String replace(java.lang.String
how to validate all form field values at once.
how to validate all form field values at once.  how to validate all form field values at once. condition:no form field shold contain sometext("--select
replace special characters in html
replace special characters in html  How can i replace the special characters in HTML?   Special Character in HTML HTML has a long list of special characters symbol that can be used anywhere throughout the HTML Code
How to pass multiple values from a servlet to JSP?
How to pass multiple values from a servlet to JSP?  hi, I want to pass multiple values form a servlet to JSP. Hw do i do that? I am able to send one...) values
dynamically how to change attiribute values in xml
dynamically how to change attiribute values in xml   Hi, I am facing the problem to update the Attribute values in XML file.dynamically how to change attribute values in XML . for example below is my XML structure. text
how to fetch values from .properties to a html file
how to fetch values from .properties to a html file  I have a .properties file with some key value pairs in it. I need to fetch the values from this .properties file into a html file.Please let me know how to do
How to carry multiple values from a Servlet to a JSP?
How to carry multiple values from a Servlet to a JSP?  By using...). ----response.sendRedirect("index.jsp?uname="+username);---- But I want multiple values needs to be carried from my servlet to a JSP. How do I do
how char values are converted to their 16-bit representation in jvm?
how char values are converted to their 16-bit representation in jvm?  can anyone explain the conversion of character 'c' to its 16-bit representation in jvm
how to store a dynamic values - JSP-Servlet
how to store a dynamic values  Dear sir, i have a ArrayList in that i have stored a values from a excel sheet specified column values and i... and bonus is ~5 . Thanks Hr in another arraylist i have a values ~2,~3
How to access session values through Ajax?
How to access session values through Ajax?  Suppose in a servlet a variable userName is kept in session. How can I access this variable from JSP through AJAX? Is it possible
regexp_replace in update and replace query in postgres
regexp_replace in update and replace query in postgres  update message set data = replace (data, 'wmost','westernmost'); April 4, 2011 at 5:04 PM.... is there a way to avoid this problem. Can you send similar query using regexp_replace
How to create bar chart using database values
How to create bar chart using database values  How to create bar chart using database values i.e excellent,good,average fields using jsp?It is like opinion poll.I want to show how many votes are came for excellent,good,average
How to values from xml using java?
How to values from xml using java?  Hi All, I want to read value from following < Line> xml using java.. In < Line>,data is in format of key and value pair.. i want to read only values..could u plz help me
MySQL Replace
MySQL Replace       MySQL Replace function finds and replaces the occurrences of specified string...: REPLACE( String_Text, String_FROM, String_TO); where String_Text
Java replace all non alphanumeric
Java replace all non alphanumeric  Hi, In Java how to replace all non alphanumeric characters with blank? Share me the best code for java replace... character. Following example show how to replace all non alphanumeric characters
MySQL replace all non alphanumeric characters
MySQL replace all non alphanumeric characters  Hi, How to replace all non alphanumeric characters in MySQL? Thanks
How to get the correct value by calculating double values....
How to get the correct value by calculating double values....  Hello Sir, I have a method in which i am getting getting wrong... and values like 59,142 etc here i am getting wrong output for the same
Difference between translate and replace
Difference between translate and replace   hiii, What is the difference between translate and replace?   hello, Replace replace every.... this work for entire word and pattern,. Translate replace the one charecte
how to get a values from processRecord - JSP-Servlet
how to get a values from processRecord  dear sir, i have a problem in getting a values from java to jsp.Here jsp is used to read a excel sheet that intern call a java program so i want a column values i.e a column contains
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file  Hi am new to java. i need to create a dynamic web application. Am using eclipse IDE and Apache tomcat server. i need
how to display the database values in pdf format
how to display the database values in pdf format   in struts how to display the values in pdf format when clicking a button in jsp page   jsp code using itext api: <%@page import="java.io.*"%> <%@page import
How to get the correct value by calculating double values....
How to get the correct value by calculating double values....  Hello Sir, I have a method in which i am getting getting wrong... is integer type and values like 59,142 etc here i am getting wrong output for the same
How to create file from input values in Jframe ?
How to create file from input values in Jframe ?  hi i m doing my project using java desktop application in netbeans.i designed a form to get the user's academic details and on clicking the submit button,it displays all
how to get the values to dropdownlist from oracle database
how to get the values to dropdownlist from oracle database   </script> </head> <body> <select name='countryname' onchange="showState(this.value)"> <option value
How to Display values from databse into table
How to Display values from databse into table  I want to display values from database into table based on condition in query, how to display... enter either bookname or authorname and click on search button the values from
how to validate values in the dynamically created textboxes?
how to validate values in the dynamically created textboxes?  how to validate values in the dynamically created textboxes in HTML using javascript? Here s my code. Anyone plz help me. Thanks in advance. <!DOCTYPE html PUBLIC
Advertisements
 

 

 

DMCA.com