ok i will try.but i don't know to use map,if u could post some links to learn about it,it would be helpful.
Type: Posts; User: shenaz
ok i will try.but i don't know to use map,if u could post some links to learn about it,it would be helpful.
class keys{
public static void main(String[] args)
{
String str="if(a greater than b)";
if(str.contains("greater than"))
str=str.replace("greater than",">");
if(str.contains("lesser than"))...
am trying to read a string and check if it contains the keywords am looking for.If it contains those keywords,i should replace it with operator.
now to check if a string contains the keyword if...
I know how to use replace() method.my problem is when i read a string,how should i check if it contains the keywords i mentioned in post#1,and then replace with its corresponding operator.
its about replacing only.but am not understanding how to do it.
Ya i tried.I just want to know what concept i should use for the problem i stated.
Suppose i have a string as fallows
if(a greater than b)
and i want to replace "greater than" with ">",how should i replace?
i want to replace the following keywords with corresponding operators...
ok. thank you.
how to write a pattern for matching the following line
print "hello world1" .
I have written a code in java for some conversion in eclipse IDE.And i have designed an UI using js and jsp.
The inteface has two textarea and browse button,convert button.I have written a Jsp code...
No more questions regarding this.Thank you.And i have already marked it as solved.
ya rite.I will include conditional check in for loop.Thanks alot for responding in early :)
ya .contains doesn't work out,instead i used .matches.It's working fine.And i removed break statement.
i just want to know if my approach in writing code was rite or i need some changes in the code...
public class arrays
{
public static void main(String[] args)
{
String int_array[]=new String[20];//int_array has a b c elements
String float_array[]=new String[20];//float_array has a1 b1 ...
Ya i want to know items in one array, say array1 is present in which array.Not the order.I just want to know which array contains elements of array1.Am sorry am not able to code properly for this.So...
ya i have tried with loops.since arrays may be of different length am getting ArrayIndexOutOfBoundException.So am not able to code.
I have 3 arrays.
array1 has a b(suppose)
array2 has a
array 3 has b
how to find in which array ,array1 elements are present?
here all 3 array may or may not be of same length.
public class first
{
public static void main(String args[])
{
String line,line1;
String array[]=new String[20];
BufferedWriter bw = new BufferedWriter(new...
I read a file containing declaration statements like int a b float a1 b1 in separate lines.
now i should copy these read line into another file by separating variables with comma as we declare in...
Ya right.complete code i din't post.it was appending to file but now i changed it.used replace().
--- Update ---
Yes yes.So i din use replace() inside loop.
Thank you:)
--- Update ---
File contains algorithm.
No problem.I will mark it as solved.
--- Update ---
I deleted writing newtxt to file.Instead after for loop i used s.replace() for replacing old contents with new.And then at once i wrote...
b.write(s.toString) i used for writing to file. And then b.write(newtxt) for replacing.
--- Update ---
--- Update ---
Thank you.As you told newtxt is not needed.But when i use replace()...
The code i posted is partial.I din post the code of main function where am reading from one file.I stored the read contents in an array and passed it to a function.I have posted only that function.
I am writing contents of array to a file.Array has "integer" "a" "b".