Putting quote round a variable name to make a string

Hi,
Hopefully this is a fairly simple task.
I would like to take a variable name, say Hyp, from my main program and call it in a class, captured in a variable called A and create a string with double quotes surrounding it... to give an answer of "Hyp" which can be used in my program for a further class call which needs the name in quotes.
I've tried using
String concat = """+A+""" but this results in an invalid AssignmentOperator
If I use
String concat = ""+A+"" I get Hyp with out the quotes - not what is required
If I use
String concat = "'"+A+"'" I get 'Hyp' which does not work with the further class which requires "Hyp"
Can anyone help?

Escape it with a \ like this:
String concat = "\""+A+"\"";

Similar Messages

  • Java variable name is in a string

    hi,
    I have a class Formatlayout.
    Now i created the object:
    Formatlayout row = new Formatlayout();
    Then I want to set the value of variable in the object row.
    I could do this by row.variable="x";
    But the name of the variable that I want to set is Stored in a String.
    So it should be row.(name in the string)="x";
    How can I do this in correct Java code?

    Google for "reflection". You will have to use the Field class in the reflection package, and no, I am not going to post a full example. Google for one, try it out, and if it doesn't work, came back, post your code (using code tags), and tell us the exact error message you are getting, or the exact difference between the effect you are seeing and the effect you want to see.

  • Jdoql sql error.. puzzled why it puts quotes in table name

    I keep getting a jdoql error when running my entity bean.. basically, something is wrong with the sql command the entity bean passes to the database.. when i set the log file to "fine" and looked at the log file, this is the sql statement it passes to the driver:
    SQL statement<select t0."id", t0."parent_category", t0."name", t0."available", t0."available_date" from "drs_category" t0 where t0."genotype" = ?> with input values:
    I noticed that it put quotes between the table name!!! this will always give me a syntax error if i run this quote straight into the informix database.. the problem is, where do i tell it to take out the quotes since it's programmed into the jdoql class... btw, i am using an informix database

    nevermind... i figured it out.. create file INFORMIX DYNAMIC SERVER.properties and put in appserv-cmp.jar ..add these lines to the file:
    # default properties for Informix SQL generation
    FOR_UPDATE=for update
    LEFT_JOIN=, outer
    RIGHT_JOIN=,
    RIGHT_JOIN_PRE=outer
    IS_NULL=\= NULL
    IS_NOT_NULL=!= NULL
    RTRIM=trim (trailing \" \" from
    RTRIM_POST=)
    QUOTE_CHAR_START=
    QUOTE_CHAR_END=

  • Variable Name Makes App Crash

    I have an embedded bitmap resource, one of many in my program, which is an AIR app.  There's nothing unusual about it; in fact, I can replace the file to be embedded with a blank white file of the same size, or another (working) bitmap from the same program, and get the following results.
    Whether my app works or not depends on what I name the variable corresponding to the embedded resource (the :Class variable after the embed directive).  If I name it "sprBatteries", the app hangs at startup in the iPhone; the loading screen transitions into the stage background color, and shows none of the stage contents.  If I name it "sprDryCells", or even "sprBatteriesX", it works fine and displays the expected contents.
    This works fine testing on my desktop, regardless of the variable name.  I suspect that it is encountering an exception on load, but it seems to be happening before FDB can connect, so I don't know what the problem could be. EDIT: Oh, and I believe that it works fine if I compile the app as a simple AS3/Flex app rather than as an AIR app.  I haven't done systematic testing to confirm this, though.
    Does anyone have any idea what could be going on and how I could fix it?

    leotemp, that's a very smart(***) answer - but don't name
    them
    what? I read your earlier post of today: you might benefit
    by looking at Aral Balkan's Quick Start about skinning the
    components.
    I have not seen anything in all the documentation about names
    to avoid in naming files. If there are restrictions on this, it
    would be nice to see a list of those names and the situations in
    which the restrictions apply. I would think renaming the file is
    not the first thing a programmer does when an unusual message shows
    up in the Problems window in FB.
    If anyone has something to say about this, please do so.
    Cheers,
    Carlos

  • Generate variable name from a String

    I've got a String "MyVariable" and I need to reference a static variable named MyStaticClass.MyVariable. How do you turn a String into a variable name?

    You can't easily do it... you can using reflection:
    MyStaticClass.class.getField().getXXX("MyVariable") //depending on what type the field is...But this seems like it may be a flawed design. Maybe you should try making a static HashMap in the class, use a Static init block and static get/set methods:
    public class StaticClass
        static Map properties;
        static
            properties = new HashMap();
            properties.put("MyVariable", "Some Value");
            properties.put("OtherVariable", new Integer(3));
        public static Object get(String property)
            return properties.get(property);
        public static void set(String property, Object value)
            //Maybe some code checking to make sure object is right type
            //or don't use a set method at all to make the properties immutable
            properties.put(property, value);
    }

  • How to use an array for variable name of swing components using NetBeans

    I'm completely new to Java and GUIs, so excuse me if I use the wrong terminology. I'm making a JFrameFrom in NetBeans. I'm getting really tired of typing instructions like jTextField15.setText(variable[15].text); I would like to make the variable names of my text fields an array so I can use a loop to change the values, text, tooltips, etc. When I click "change variable name" it won't let me put an array in. The code that Swing generates is protected and I can't change it. I know there must be a way to do this. Any help is appreciated.

    Try not to use the NetBeans visual GUI builder. Then it should be easy to create an array of text fields:
    JTextField[] tfs = new JTextField[15];
    for (int i = 0; i < tfs.length; i++) {
        tfs[i] = new JTextField(10);
    }For laying out the text fields, see: [http://download.oracle.com/javase/tutorial/uiswing/layout/using.html]

  • Delete with variable name

    I need to run a SQL command in one of the step in my procedure where I need to run command like >>>> Delete from TableA where Column1 LIKE 'MY_VAR' but while running its not substituting the value of MY_VAR.....Any clue how can I run command like this where I have refresh the variable before executing the procedure in the package so variable is declared before procedure execution.I dont wanna refresh the variable with Quotes around because I am using this variable in different places. Any clue how can I put quotes around MY_VAR in Like stament.
    I have also tried this>> Delete from TableA where Column1 LIKE '''MY_VAR''' but still variable value is not substituting.

    The substituted variable will never appear in the log, how are you figuring out it does not get substituted?
    In the syntax, you should use something like the following:
    Delete from TableA where Column1 LIKE '#MY_VAR'If you use the expression editor to do select the variable name, it should ensure that it is put in correctly. To see if it is actually recognised, in the log, you should see
    Delete from TableA where Column1 LIKE '#MyProject.MY_VAR'Craig

  • Can I override Pro*Fortran's limit on Fortran variable name lengths?

    The Fortran standards put a 31-character limit on the variable names in Fortran code. Some compilers allow you to exceed this as a compiler extension, and, unfortunately, our code has places where we actually do... The present software compiles and runs under with the Ingres 9.2 RDBMS, but we're starting the process of porting the code over to Oracle 11g.
    The Pro*Fortran (we have release 1.8.79.0.0) precompiler only accepts the first 31 characters of a long var name (yes I found that limitation stated in the Pro*Fortran Precompilers guide). What I am wondering is if there is any way to override that and allow a longer name to be used. The Sun studio compiler accepts it, just not the precompiler. Searched the docs and found nothing about overriding things like this.
    If necessary, yes I can shorten the variable names. I'm just trying to minimize the amount of code changes required.
    Jim

    You are correct.
    5 lines below the QUERY DATA SOURCE NAME block property line
    is the ‘where clause’ line
    It already had FAC_ID = :FACILITIES.ID
    I found that if I added my :Blk_name.Pass_cd_num
    I could see it my new bind variable in a system.last_query display.
    I found the QUERY DATA SOURCE NAME below the ‘from query clause’ truely
    is the from clause and it will not except any :Blk_name.item_name
    (Because is is just for tables)
    But the ‘where clause’ property line will except bind_variables
    :Blk_name.item_name is successful in the where clause.
    (where Capturing_devices table being the block’s base table)
    -- **FROM**
    SET_BLOCK_PROPERTY('EMISSION_POINTS',QUERY_DATA_SOURCE_NAME,
    'EMISSION_POINTS A,
    EP_MODES B,
    CAPTURING_DEVICES,
    CONTROL_DEVICES CD');
    -- **WHERE**
    SET_BLOCK_PROPERTY('EMISSION_POINTS', DEFAULT_WHERE,
    'A.ID = B.EP_ID AND
    B.ID = CAPTURING_DEVICES.PARENT_MODE_ID AND F
    CAPTURING_DEVICES.CD_ID = CD.ID AND
    CAPTURING_DEVICES.CD_ID IS NOT NULL AND
    CAPTURING_DEVICES.PARENT_MODE_ID IS NOT NULL AND
    CAPTURING_DEVICES.STACK_ID IS NULL and
    B.FAC_ID = :FACILITIES.ID and CD.NUM = :emission_points.cd_id_num');
    --**ORDER BY**
    SET_BLOCK_PROPERTY('EMISSION_POINTS',ORDER_BY,
    '(A.NUM, C.PARENT_MODE_ID, C.CD_ID)');
    EXECUTE_QUERY;
    I still get a FRM-40505: Oracle error: ‘unable to perform query’
    (I know its because of the way it is coded),
    But I did learn bind variables can work in the where clause.
    Also I tried using the hidden field like you suggested.
    If you put char character field in a where clause it will come out in quotes
    So I assigned it to a block.hidden_item (number) like you suggested
    that did strip off the quotes.
    That left me with passing the value of 31, I need to pass 0031
    I tried to do a LPAD to the value left pad it with zeroes
    But that did not work.
    I went back to my effort in using a cursor loop to populate the block
    Thanks

  • Same variable name causes major issues.....

    I would like to get some input and possible direction on the issue below... I am new to PL/SQL. Thanks in advance.....
    ..... The system is in the middle of processing a “For” step, i.e. a given “For” step is incomplete.
    ..... The script instructs the system to process a second “For” step with the same “for-loop variable” as the incomplete “For” step.
    When the above takes place, the system processes the second “For” step incorrectly. Instead of starting at the first value in the second “For” step’s list of values, the system begins in the middle of the value list.
    I need to change the current implementation so that if a "For" loop is encountered that has the same “loop variable” as a “For” loop already being executed, the “state” of the previous “For” step is discarded, and the state for the new “For” step is initialized to the first value in its list.
    -- Used for "for" steps
    TYPE for_list is table of varchar2(4000) index by binary_integer;
    TYPE for_loop_state is record (
    list for_list,
    next_index integer
    TYPE for_loops_list is table of for_loop_state index by steps.output_param%TYPE;
    all_for_loops for_loops_list;
    procedure for_step(list_string IN varchar2, ret_var_name IN varchar2, end_for_label IN varchar2) is
    state for_loop_state;
    end_idx number;
    list_value varchar2(4000);
    begin
    pkg_util.log('ret_var_name value after begin: ' || ret_var_name, 'I');
    -- get the current for list state, based on its output variable name
    if all_for_loops.exists(ret_var_name) then
    state := all_for_loops(ret_var_name);
    else
    state.next_index := 0;
    list_value := parse_next_param(list_string, 1, end_idx);
    -- end_idx is thrown away; for loops only have 1 input parameter (the list)
    state.list := get_for_list(list_value);
    all_for_loops(ret_var_name) := state;
    end if;
    if state.next_index < state.list.count then
    pkg_session_values.put(ret_var_name, state.list(state.next_index));
    all_for_loops(ret_var_name).next_index := state.next_index + 1;
    else
    all_for_loops.delete(ret_var_name);
    jump(end_for_label);
    end if;
    end;

    There is so much of your code hidden from view it is impossible to tell you anything other than perhaps suggest a methodology.
    Create a single variable with a known value and use dbms_output to view it as it steps through each piece of the puzzle. Determine when the value does something you don't want.

  • Can anyone help me change the DOB on my sons profile for his apple I'd so I can setup family sharing? I originally put both ids in my name. He is 19 do it keeps saying needs my permission but no instructions in how to get that done?

    Can anyone help me change the DOB on my sons profile for his apple I'd so I can setup family sharing? I originally put both ids in my name. He is 19 do it keeps saying needs my permission but no instructions in how to get that done? His phone was stollen once last month need to get this done ASAP to prevent future headaches. Ty

    You can not change the date of birth on the account. Apple makes that clear up front when the account is created.
    The only way to "fix" this is going to be for him to create a new account with the correct information. Any apps purchased with the old one will need to be re-purchased with the new account. They can not be transferred.

  • How do I take data from a data grid and put it into a variable?

    I am having problems taking data from a datagrid (guess you got that from the title) and setting it to a variable. I am tak
    ing the data from 3 different rss feeds, depending on what button you press, and showing it in a grid. I would like to be able to do more with this data. Here is my code so far:
    <mx:VBox id="vbox" x="70" y="150">
      <mx:Label text="This Data Grid is doing nothing" />
      <mx:DataGrid width="1000" dataProvider="{fullXML}">
       <mx:columns>
        <mx:DataGridColumn id="dataGrid" *dataField="channel.description" headerText="Feed"/>
       </mx:columns>
      </mx:DataGrid>
    </mx:VBox>
    <!-- from test 5 -->
    <mx:Move id="moved" target="{hbox}" repeatCount="0" easingFunction="mx.effects.easing.Linear.easeIn" />
    <mx:HBox id="hbox" fontSize="12" fontFamily="courier">
      <mx:Label text="{website**}" />
    </mx:HBox>
    * this is the data I want to get out
    ** this is where I want to be able to put the variable.
    I don't know if I can do it here or if I need a function or what.
    I would like to be able to put it into an array, but step one is anything at all, so I'm trying just a variable.

    Where do I put that line of code? I see that it goes at the Script part near the top, but how can I use that, I am pretty new to this language. I am not familiar with this line, where does it bind the value from the datagrid to the variable?
    fullXML[myDataGrid.selectedIndex].FIELD_NAME;
    myDataGrid would be the id from the grid I am guessing?
    and selected index would be the channel.description part?
    and FIELD_NAME; is the variable name?
    does this go into a funtion or is it placed at the top where the variables are declared?

  • Using a variable's definition as a variable name

    I have a string variable with definition I need to use as a
    variable name.
    For example, this is super simplified:
    var newVariable = 'it is working';
    var partOne:String = 'new';
    var partTwo:String = 'Variable';
    var partThree = partOne + partTwo;
    trace("my variable is " + partThree);
    Instead of tracing partThree as literally partOne + partTwo
    (which traces "newVariable") i'd like it to trace the
    Definition of partOne + partTwo (which is "it is working").
    I hope this makes sense, help or advice is
    appreciated.

    ...
    var partThree = this[partOne + partTwo];
    trace("my variable is " + partThree); //will trace: my
    variable is it is working
    TS

  • Variable names display problem

    I have three transparent text captions that are set to display from slide 1 through to slide 32 (using the option "display for rest of project").
    The variables I am displaying are:
    In the header:
    $$cpInfoProjectName$$ - displays the name of the lesson module.
    $$cpInfoCurrentSlideLabel$$ - displays the name of the current slide.
    And in the footer:
    Page $$cpInfoCurrentSlide$$ of $$rdinfoSlideCount$$ - displays the current slide number and the total number of slides in the lesson.
    The problem is that the variable names display long enough to look somewhat unslightly. It might be for about 1/3 of a second but it is long enough to screen capture (attached just in case I am not clear enough in my description) this appearance before they resolve into their values.
    This is rather annoying, since a student will see this occur for every slide.
    Is there anything that can be done to fix this? Perhaps using a text caption is not the best way to display these variables?
    Hmm... I wonder if creating a small persistant flash insert would be better?

    I have seen that aswell Shawn. It seems like the variables are a bit slow to be populated with the correct value and then it will show the $$variable_name$$.
    A Flash component would solve it and it won't take more than 5 minutes to make them all.
    /Michael
    Visit my Captivate blog with tips & tricks, tutorials and Widgets.

  • Accessing variable names using String

    I have to check up to 13 JCheckBox variables to see if they are checked or not, and I have the variables named: count1, count2, count3,...,count13. I wanted to know if there was a way to go through them in a while loop until I found the last one that was checked. I want to do the following:
    int i = 1;
    while([count+i].isSelected()) {
    i++;
    int foodCount = i;
    //foodCount is stored in database
    I am doing this for a pet store and I don't want to have 12 extra columns in the database - I just want to have one for the overall food count. Any ideas how I can dynamically create a variable name?

    Put the JCheckBoxes in an arrayJCheckBox[] myCheckBoxes = {check1, check2, check3,...,check13};
    JCheckBox someCheckBox = null;
    for (int x=0; x<myCheckBoxes.length; x++) {
      if (myCheckBoxes[x].isSelected()) someCheckBox = myCheckBox[x];
    }

  • Dynamic Variable Names

    Okay, I just need to figure out how to make dynamic variable
    names. In this case, I have a loop, and inside the loop I need to
    create a new array for every iteration of the loop. Something like
    <cfloop from="0" to="10" index="i">
    <cfset LoopArray#i# = Some Value>
    </cfloop>
    But that doesn't work. How can you make dynamic variable
    named? I think it's probably something to do with evaluate or DE,
    but I don't know how to use them, and the livedocs make no sense to
    me. Thanks!

    On Thu, 22 May 2008 17:14:42 +0000 (UTC), kenji776 wrote:
    > Thank you both for your replied, I did manage to find a
    solution (the same one
    > posted by JR "Bob" Dobbs). Pretty much just looks
    like...
    >
    >
    > <cfloop from="1" to="3" index="i">
    > <cfset LinkResults["#i#"][1] = "Player 1's Move
    ID">
    > <cfset LinkResults["#i#"][2] = "Player 2's Move
    ID">
    > <cfset LinkResults["#i#"][3] = "Damage to player
    1">
    > <cfset LinkResults["#i#"][4] = "Damage to player
    2">
    > </cfloop>
    From your values, you don't want a two-dimensional array
    (which although
    you're actually building LinkResults as a struct, with the
    sequential
    numeric keys, it's basically an array), you want an array of
    structs, eg:
    LinkResults
    .player1.moveId
    LinkResults.player1.damage
    What is "i" actually counting through? IE: from 1-3 things...
    which are...
    what?
    Adam

Maybe you are looking for

  • How do I change the submit to email address?

    I have made a form in Adobe Acrobat X Pro, and initially I wanted the form to be sent to one email and I entered it in, but now that person is no longer accepting the forms and it needs to be routed back to me. Unfortunately, I cannot seem to figure

  • Does the air vents in the MacBook Pro Retina take in air or blow out air or do both?

    I was using my MacBook when I saw a dust ball going near my air vents & and disappeared. So i was wondering if the air vents could have taken in the dust ball

  • How to share schemas between BPEL-processes?

    Hello everyone! I'm trying to build a simple BPEL-SOA-like application using Oracle SOA Suite. How can I share these schemas between the different processes? For example I have a "main" BPEL process which receives a customer as input and later has to

  • Reinstalling OS X using original install discs

    In preparation for giving away my old iMAC PPC, I followed the instructions for zeroing all data using the original install discs. I then wanted to reinstall OS X. Again, using the original install discs, disc #1 did it's thing perfectly. When prompt

  • Periodic Execution of Work Instances [ JCA 1.5 ]

    Hi folks! I have studied JCA for a little while now and i have successfully deployed a jca adapter that reads and writes files. Now, I need implement a periodic execution of work instances. And JCA�s specification recomends to use java.util.Timer, be