deepika deepi

Ranch Hand
+ Follow
since Jan 23, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by deepika deepi

Campbell Ritchie wrote:I find it difficult to understand your question. You would appear to want to run the if and the else, combining their “output”. You would do well to play with replaceAll, and see what happens when you do and do not have R1 inside the String. I suspect the if-else is unnecessary.
You might do well to investigate Maps; R1 = bus/train looks like something a Map is very good at implementing.



ya your correct in that case it is not necessary . If the input is given from a string instead to direct place. I think it is necessary



in this case the values are printed multiple times. So i would like to use if.contains(res) and else part separate the output. So i am looking to get the combined result of both. I hope you will understand why i am using if else in above.
12 years ago
Hi all,
Suppose i have an input like this

R1 : (bus,train)
R2 : (bicycle,bike) R1
R3 : (lorry,tractor) R1

I have replaced the words R1 with (bus,train) and got the result.

Now i would like to have the combined output all into one after using the if else i need the combined output of both . How to make it achievable ?



This is the code for replacement. How can i combine the if and else output into one and get the result? Suggest me
12 years ago
Hi all,

I have an directory file and there are so many files inside the directory. I want to pass the string from one class to another and get the result.

main for the directory file


class file name declared with main
input files in the Directory templates are 1.txt
NAME
REGISTER NUMBER
STANDARD
SCHOOL NAME

2.txt
STAFF ID
NAME
SALARY
EXPERIENCE

here i would like to make an pattern matching. if the directory file matches with 1.txt it should print the contents inside 1.txt.so for that i want to pass the file names to the Dircheck1 and get the result. The file name called here and stored in name text in the pattern matcher.

So i want to pass the file names from one to another and get the result. I hope i am clear in explaining. Guide me how to reach the desired output.
12 years ago

R. Jain wrote:

deepika deepi wrote:size of the array is 15.


In which case, you are not getting your code..
Try to print the array obtained as you split your keyword.. Also print its length..

deepika deepi wrote:
keywordsplit[0] contain output: located serve chief
keywordsplit[1] contain output: reserve biosphere star
keywordsplit[2] contain output is not displayed


No they don't.. Try printing array and see what you get..



Ya i got the result using for loop
12 years ago
hi all,

Good morning . I have an input and i want to match with the regular expression and get the sentence that matches the output instead of the keywords.



The above code gives the output for the keywords that is matched. I would like to see the sentences instead of keywords.
Is it possible in using Regex ? Still i have seen such things have not been done. So if this method is wrong any other method is possible to get the result?
12 years ago
ya. thank's a lot. the problem solved..



Getting the output Thank's to all
12 years ago

Christophe Verré wrote:Just in case, when I said that you may prefer using StringBuilder, I didn't mean that this would fix your problem. Creating a new StringBuilder in a loop will still erase all previous content.



ya i have changed that. thank you. Can you tell me with little more explanation, where to use StringBuffer and StringBulider ?
12 years ago

John Jai wrote:Post your changed code for further assistance.



I have changed only one line in the code.

is changed to

I am confused how to proceed. Guide me with the steps
12 years ago

Christophe Verré wrote:Creating a new StringBuffer in a loop will obviously erase all previous content. (by the way, you may prefer using StringBuilder).



ya. i have changed.But could not find any changes in the output.
12 years ago
Hi i have n input file. I want the words in that to be appended.

help s1
start s2
solved s3


i would like to append the words in this like
|help
|help|start
|help|start|solved.


the code i have used for append



Problem i am facing. the append is not done after the word in the next line.
the output is like this:
|help
|start
|solved


I may not be clear in the explaining.But if you see the output you might be clear.
How to proceed this?
12 years ago

R. Jain wrote:
What will be size of array generated when you use the above split code??


size of the array is 15.

this is the input having maximun number of array


001 001001 located,reserve Rule1.0
001 001001 serve,biosphere Rule1.1
002 002002 star Rule2.0
002 002002 chief,star,main,popular,tourist,famous,attractions,attraction,important,destination,renowned,renown,popularity,fascinating,interesting,entertaining Rule 2.1


keywordsplit[0] contain output: located serve chief
keywordsplit[1] contain output: reserve biosphere star
keywordsplit[2] contain output is not displayed

It gives am error:
java.lang.ArrayIndexOutOfBoundsException: 2
at A.method1(Ruleselection.java:32)
at Ruleselection.main(Ruleselection.java:92)


12 years ago

Winston Gutkowski wrote:

deepika deepi wrote:code is:


No it isn't; because that code could not possibly produce the output you say it does.

i hope i am making it easier now. I have given all the datas. Help me.


As I said before, EaseUp. Simply repeating "Help me" isn't going to get the job done any quicker.

Read the HowToAskQuestionsOnJavaRanch page; and also this one and this one.

And when you've done that, come back and explain your problem, NOT your solution.

Winston



my problem is

the word serve and located i have the rule as Rule1.0 according to the input file.

the word is splitted using , then the splitted rule is matched with the rule.

the word serve is splitted with and matched against the rule. the rule is supposed to be Rule1.0 but it is going to the next rule number. i don't want to match the word serve with the next rule . i want it to be matching with the input rule file. I have explained to my best. If you could see the actual output also you will be able to see that. I have tried my level best to explain the problem
12 years ago
the expected output is:
line output:located Rule1.0
line output:serve Rule1.0


the actual input is :
line output:located Rule1.0
line output:serve Rule1.1


code is:


input file is:
001 001001 located,reserve Rule1.0
001 001001 reserve,biosphere Rule1.1


i hope i am making it easier now. I have given all the datas. Help me.
12 years ago

R. Jain wrote:

deepika deepi wrote:
Yor telling to use like this

String[] input = sentence.split("\t");

String integer = input[0];
String integer1 = input[1];
String keyword = input[2];

String rule = input[3];
String[] keywordsplit = keyword.split(",");
String integer = keywordsplit[0];
String integer1 =keywordsplit[1];



Yes.. you did it right.. Check the duplicate names in variable declaration..



for what purpose i need to check the duplicate names. i don't understand.
can you be bit clear.
12 years ago

Winston Gutkowski wrote:

deepika deepi wrote:ya they are keywordsplit[0] and keywordsplit[1] will be words


Right, so don't put them in fields called 'integer...'. It's confusing.

Winston



ya i have corrected it how to get the expected output from the actual output. Help me
12 years ago