hello friends,

I have s small problem, say if I declare a variable as

String name="miraj";

now i want to use the value of the variable name, that is "miraj" and create a file using that name, which means something like miraj.txt ...

how do I do it? The part that i don't get is the method by which i could extract the part "miraj"??

would really appreciate your help :)

Recommended Answers

All 8 Replies

Uhm, what do you mean "extract the part".

To concatenate Strings you use "+" of course. I.E.

string1 + string2

Uhm, what do you mean "extract the part".

To concatenate Strings you use "+" of course. I.E.

string1 + string2

well , what i mean is, how can i use the variable value, that is "miraj" in the example that i have pointed out, and use "miraj" to to name a file, that is i want to make a file named miraj.txt

Uhm name + ".txt" , maybe?

Why do you think I showed you how to do String concatenation?
Not as though you are extracting anything though.

Uhm name + ".txt" , maybe?

Why do you think I showed you how to do String concatenation?
Not as though you are extracting anything though.

yeah, I tried it bro, it doesn't work :(

Uhm name + ".txt" , maybe?

Why do you think I showed you how to do String concatenation?
Not as though you are extracting anything though.

oh, my bad ! it does work bro...thanks a million :D

Rule of thumb: if masijade says it, it probably works. I'm just sayin', the guy knows his stuff.
Second rule of thumb: "it doesn't work" is not a useful error report, and will probably get you nothing useful back. Next time, say what you tried, what you expected to happen, and what you saw instead.

Oh, thtop it!. I'm blushing!

Rule of thumb: if masijade says it, it probably works. I'm just sayin', the guy knows his stuff.
Second rule of thumb: "it doesn't work" is not a useful error report, and will probably get you nothing useful back. Next time, say what you tried, what you expected to happen, and what you saw instead.

yes,that's is a very valuable piece of advice :) thanks a lot...I shall keep those points in mind in my future questions...thanks friend.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.