Extract Variables and Values out of a String

Hello Everbody!
I have a question, hope that anyone can help me.
I have a string of this kind: "frame= 2255 q=0.0 size= 2739kB time=75.0 bitrate= 299.3kbits/s"
Know I want to deconstruct it and extract the variables and
values written in there. There is some Whitespace in it.
After the extraction it have to look like this:
frame=2255
q=0.0
Greetz Christian

What is a StringTokenizer?http://java.sun.com/j2se/1.5.0/docs/api/java/util/StringTokenizer.html
Can you give me an
example? Would be great! http://www.google.com/search?q=java+stringtokenizer+example
You can first use space as the delimiter, to get tokens
a=b
c=d
etc.
Then you can tokenize each of those tokens on =.
However, this doesn't work if you can have spaces around the = or inside the values:
a = b
c="d e f"
If you can have this, you'll have to take a different approach. String.split might serve you better in that case, but you'll have to learn a bit about regex first.
Sun's Regular Expression Tutorial for Java
Regular-Expressions.info

Similar Messages

  • SAP Table for Custom variable and values?

    Hi folks.
    I am looking for a SAP standard table which I recall existing. This table was designed by SAP to store a variable name and value(s), so that no programmer would ever hard-code values into their reports. Instead, the programmer would create a new record in this SAP standard table with a unique variable name, and assign the constant value to this variable.
    In the report this variable would be read from the table and the value used. I think this table starts with T, but not sure.
    Does anyone have any idea what the name of this table is?
    Regards,
    Eugene

    Hi Shameem,
    This is a profitability analysis reporting table, which is not what I was looking for. The table I remember was a cross-application table that was specifically created for the purpose.
    Regards,
    Eugene

  • XML Publisher, define variable and use out side the group

    Hi
    Is there any way that I can define a variable in the group and move XML data like line amount into that variable and use into outside the group.
    Regards
    ASIM

    I figured it out
    in your select if you want to group your output by say Organization_id change your select in your burst file to the following
    <xapi:request select="/PAYSLIP_REPORT/PAYSLIP/EMPLOYEE_DETAILS/ORGANIZATION_ID">

  • How to parser a HTML page to get its variable and values?

    Hi, everyone, here is my situation:
    I need to parser a HTML page to get the variables and their associated values between <form>...</form> tag. for example, if you have a piece of HTML as below
    <form>
    <input type = "hidden" name = "para1" value = "value1">
    <select name = "para2">
    <option>value2</option>
    </form>
    the actual page is much complex than this. I want retrive pare1 = value1 and para2 = value2, I tried Jtidy but it doesn't reconginze select, could you recomend some good package this purpose? better with sample code.
    Thanks a lot
    Kevin

    See for example Request taglib from Coldtags suite:
    http://www.servletsuite.com/jsp.htm

  • White paper on Batch List Variables and Values?

    Is there a guide somewhere that discusses all of the variables and appropriate values for a batch lists. I noticed not all variables in Item Properties can be detected from a batch list. Also it's not clear what value is required for the "Good" column for example

    I'm looking for more details on the variables and appropriate values you can use when creating batch lists.
    Marking the "Good" column is only a descriptive note made by yourself.
    Aren't all columns meant to be descriptive notes for yourself? I meant what value do you give the Good column in a batch list for it to be checked when imported in Final Cut.

  • Send Captivate user variables and values to the LMS ?

    Hi all. has anyone got a clever way to send a bunch of Captivate user variables and their values to an LMS (Moodle) so that they end up recorded as part of the SCORM course results or do these need to be explicitly part of a Quiz ? I think that I can setup where I get these values from the Learner so that they take the form of a Quiz (even though there is not a right answser) and set the the LMS settings to record interactions and scores. But is there an easier way to send them via LMSSetValue or even using a widget ?
    Fergal

    You can do it, but it will definitely not be the easiest way to achieve the objective. The accessibility of your web form will determine what you can and can not do.
    The first issue would be populating the field of the form, and that can be achieved by actually re-generating the form programmatically and assigning a value to the html value tag for that field.
    The second issue of "click on the button" is not trivial. If you're in the windows environment you will have to get into intercepting windows messages from the message queues and get the handle of the web browser window and after finding all the relevant information that will change every time this process is performed, is in my opinion not worth the effort.
    I would approach this di
    fferently in looking at what you are trying to achieve in the first place and that is to do directly with the data what the form would've done.
    Forms will either send some e-mail to someone using the submitted data or submit information to a database or write it to a file. If you have a cgi script behind the form you can pass the information directly to the script rather, i.e call the scrip directly in the same way the form would've using your program and skip the form.
    If you can be specific about your objectives and give me details about the forms and detail on the web server type and the capabilities of handling various types of cgi scripts I can give you detailed advice and pointers towards achieving the solution.
    Questions you need to answer:
    What would the form do with the data? (mail, file, database etc.)
    How many fields do you need to submit?
    What type of web server are you running? (IIS, Apache etc.)
    Were is the form hosted, on the www
    or on an intranet?
    Is it accessible to you to change/add scrips to it?
    Hope this helps.
    Best regards
    Jattie van der Linde
    Engineering Manager, Software & Automation
    TEL Magnetic Solutions Ltd

  • Loop through a model to get variables and values

    I use an AS model (named AppGlobals.as) to store the application variables. I need to replace the hard-coded values of the elements to ones pulled from a database. As such, I need to iterate through the model to find all the elements that match my query results and then set the value of the elements to those returned from the database query.
    My current issue is that I have no clue how to iterate through the model to get the elements so that I can use them a parameters for my query. An example of AppGlobals.as follows...
    package com.models
              [Bindable]
              public class AppGlobal
                        public var appAnnualMaintenanceAlert:String="The System is unavailable due to routine annual maintenance!  Please check back after 2:00 PM Eastern on  January 1, 2012!";
                        public var appAnnualMaintenanceStart:Date=new Date(2012, 11, 31, 18, 0, 0, 0);
                        public var appAnnualMaintenanceEnd:Date=new Date(2013, 0, 1, 14, 0, 0, 0);
                        public var appYearPrevious:String="2011";
                        public var appYear:String="2012";
                        public var appYearNext:String="2013";
                        public var dttm_landing_expected:String="1/1/2012 12:00:00 AM";
    How can I iterate through the model to find all the var names and then match them with my query to return the corresponding values?  Any help is appreciated.
    Thanks!
    Lee

    Hi,
    "elided" and "hidden" both have UI purpose (make the UI lighter) but are quite different:
    "elided" is a static attribute of property groups (readonly, and After Effects never changes the value internally).
              The children of an elided group are not necessarily elided.
    "hidden" is NOT an attribute, is dynamic, and "undocumented".
              The After Effects UI hides everything that is not needed in the layer property tree (for instance the material option group is hidden when the layer is not 3D, since it is not used anyway).
              Hidden groups and properties are still there though and can be accessed by script, one can read their values and attributes, scout their property subtree, but one cannot set anything on them nor select them (in both cases an error is generated).
              And the children of a hidden group are hidden.
    Since there is no attribute corresponding to "hidden", it is uneasy to know whether a property is hidden or not. I can only see a case by case "treatment".
    For instance:
    is myLayer.layerStyle hidden ? <===>  !myLayer.layerStyle.canSetEnabled
    is myLayer.transform.xRotation hidden ? <===>  !myLayer.transform.xRotation.canSetExpression
    is myLayer.mask hidden ? <===> myLayer.mask.numProperties===0
    is myShapeLayer.content hidden ? <===> false (never hidden, even if empty)
    etc...
    Xavier.

  • How can I extract high and low parts of a string that represents a 64bits decimal number?

    I want to extract the high and low parts to interpret it and convert to binary code, but such a hugh number (represented by a string) isn't easy to extract from the string directly its high and low parts.

    LabVIEW can't handle a 64-bit integer. You will have to store it as two 32-bit integers. If you need exact math on those 64-bit intergers you will have to make up your own routines to handle the carries and what not. If you just need pretty good accuracy, covert both 32-bit integers to double, multiply the upper 32-bit number by 2*32 (also a double) and then add the lower 32-bit number to it.
    Good luck.

  • Error handling with EPG pages, displaying proc variables and values

    With OAS, a failure in a PLSQL-generated page usually brought up a plain page of preformatted text showing a) the basic Oracle message for the failure, b) all the passed-in parameters by name with their values at the time of failure, and c) the CGI environment variables with their values.
    When I use the EPG, and failure occurs, I get something like ".../dad/pkg.proc not found", which is worthless as an outcome for a user to see. Now I got around this a bit with an EXCEPTION section, and using OWA_UTIL procs got some info that is helpful in debugging. But I very much would like to get the list of passed-in parameters with their values, and the documentation is not revealing great wisdom to me for achieving this.
    Does anyone have some knowledge or code to share that will achieve this within the bounds of XE? Perhaps another thread has addressed this and I could have the URL?

    In order not to expose sensitive information, the embedded PL/SQL gateway (EPG) returns only a very basic error page in the default setup when an exception occurs when attempting to execute the procedure. To get a more elaborate error page like what OAS returns, you may set the DAD attribute as follows:
    sqlplus system/...SQL> exec dbms_epg.set_dad_attribute('APEX', 'error-style', 'DebugStyle')
    to reset it, please delete the attribute
    SQL> exec dbms_epg.delete_dad_attribute('APEX', 'error-style')
    This assumes that you are using the defalt DAD "APEX" that comes preinstalled in XE.
    See the doc on the different error styles at http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14190/confmods.htm#CIHCIIJG
    Thanks.

  • Retrieving Variables and Values using EPM Functions

    Hi Experts
    Does anybody know how this fuctions works with and example?
    32.26 EPMVariableList
    Applies to: SAP BW (INA Provider) connections.
    This function retrieves the list of variables for the query for the specified connection. You can display the
    variables:
    ● in the current cell, where a specified character separates the variable names.
    ● in one or more dropdown lists
    32.27 EPMVariableValue
    Applies to: SAP BW (INA Provider) connections.
    This function retrieves the value(s) currently selected for the specified variable. The value(s) is (are) retrieved in
    the cell in which you enter the function.
    I already checked the EPM Add-in for Microsoft Office User Guide but is didn't say anything helpfull
    Regards
    Ariel

    Hi Ariel,
    It's clearly stated in help: "Applies to: SAP BW (INA Provider) connections."
    And if look on connection types:
    4.4.2 SAP BW (INA Provider) Connections
    Using the SAP BW (INA Provider) connection, you can do the following:
    • Work with BW queries (with or without variables).
    • Retrieve data, using reports.
    • Enter and save data, using input forms.
    • Execute planning function for BW Integrated Planning, using what are called in the EPM add-in "data processes".
    And some info about 10.1
    Unfortunately I don't have 10.1...
    Vadim

  • Creating a Leaderboard / Extracting Variables from a Project

    Hi All, I hope someone can offer some advice or point me at a tutorial. I am starting to dabble with Variables in Captivate using advanced actions etc. I am looking to create a piece of learning which tracks choices made in the module and provides the user with a score based on those choices. I have advanced actions updating a variable which I then present to the user at the end and in my practice module this is working.
    What I would like to do is encourage some competition by showing a leaderboard of other users scores to drive people on. I thought that if I captured the users name at the beginning of the module and then took that value and their score that would be enough. What I don't know how to do (if its possible) is to either create a leaderboard within the module that would update itself and show to new learners OR can I take the name and value out of the module somehow and present externally in a leaderboard.
    Im no programmer so any ideas would need to be fairly simple to execute, I plan to host the module on a Moodle based LMS. If that helps with possible ideas.
    Does anyone have any ideas / past experience with something like this? If  I can provide further info to assist then please let me know. I appreciate any help.
    James

    Jay,
    What you would need to do is store data about user scores OUTSIDE your Captivate module.  Captivate 8 has no built in functionality to achieve this without using some kind of database-driven system such as an LMS. 
    Other user's scores can be stored in the LMS database (that's after all what LMSs are designed to do) but extracting data about those other users and displaying it inside each and every Captivate module session as a leader board would require custom programming.
    You'd need some kind of scripting technology on the LMS side that was able to run queries against the LMS database and pull the data, then more custom scripting to send that data to your end user's Captivate session. It's not going to be a trivial exercise. 

  • How to find out the type of the value stored in a string variable?

    Hi,
    How do i find out the type of the value stored in a string variable?
    for example,
    I have a string variable str, in which the following type of values wil be stored
    1) Intger
    2) Long
    3) boolean
    4) Char
    Is there any method to find out the type of the value, anything like str.getType()?. Please kindly help me. Thanks in advance.

    Hi All, i'm sorry for the double posting, by mistake it occured.
    Thanks for your replies, i have a string variable str, in which the value is stored and i have another string variable type, in which the type of the value is stored.
    For example,
    String str = "15";
    String type = "Integer";
    Is there any way to verify whether the value stroed in str is of type stored in the variable 'type'. I want to write a method of type boolean, it will throw true of the value stored in str is of type 'type'. Thanks

  • Doubt about  a null value assigned to a String variable

    Hi,
    I have a doubt about a behavior when assigning a null value to a string variable and then seeing the output, the code is the next one:
    public static void main(String[] args) {
            String total = null;
            System.out.println(total);
            total = total+"one";
            System.out.println(total);
    }the doubt comes when i see the output, the output i get is this:
    null
    nulloneA variable with null value means it does not contains a reference to an object in memory, so the question is why the null is printed when i concatenate the total variable which has a null value with the string "one".
    Is the null value converted to string ??
    Please clarify
    Regards and thanks!
    Carlos

    null is a keyword to inform compiler that the reference contain nothingNo. 'null' is not a keyword, it is a literal. Beyond that the compiler doesn't care. It has a runtime value as well.
    total contains null value means it does not have memory,No, it means it refers to nothing, as opposed to referring to an object.
    for representation purpose it contain "null"No. println(String) has special behaviour if the argument is null. This is documented and has already been described above. Your handwaving about 'for representation purpose' is meaningless. The compiler and the JVM don't know the purpose of the code.
    e.g. this keyword shows a hash value instead of memory addressNo it doesn't: it depends entirely on the actual class of the object referred to by 'this', and specifically what its toString() method does.
    similarly "total" maps null as a literal.Completely meaningless. "total" doesn't 'map' anything, it is just a literal. The behaviour you describe is a property of the string concatenation operator, not of string literals.
    I hope you can understand this.Nobody could understand it. It is compete nonsense. The correct answer has already been given. Please read the thread before you contribute.

  • How Do I Store HTML in a String Variable and then display in JSF

    Hi,
    I generate some HTML code and store in a String varible (ie. String str = "<b>Hello World</b>";)
    I want to display the HTML in a JSF page. I tried using <h:outputText value="binding to the variable"/> and it prints out the entire string and not the rendered HTML i desire.
    I also enclosed the <h:outputText> within <h:verbatim> tags and that does not work either.
    I want to display some generated HTML without having to make a custom component.
    any help would be appreciated.
    Thanks,
    -d

    Simply use the escape attribute of h:outputText.
    Here is the code :
    <h:outputText value="binding to the variable"
                  escape="false"/>

  • Pass variable and set default value based on user's group

    Hello
    I'm using SharePoint 2010 and SQL 2012. I need to send a variable to the page and based on its value, set default value for a drop down list and send it to other web part to filter the data. Is it possible for certain users to send that value as a default
    and limit user to see only this value in the text field or drop down list; for others - to allow to see the drop down list, but also set the default value for that list?
    The main page was designed in SharePoint designer, using web parts (aspx page). I had setup a connection to Active Directory and already have the code to get user's groups and based on their group, I have that variable pulled into the web page for further
    use. But I don't know how to pass that value as a default value to the web part (currently using SharePoint Filter web part). When I tried to set a default value for the web part - it automatically puts the quotation marks around the name of the variable
    and shows it as a text instead of showing the value of the field.
    Thank you!
    P.s. I have limited knowledge of SharePoint and need guidance (links, examples, recommendations)!
    Alla Sanders

    Thank you for your response. I'll try to give you more details. On PageA I check user's groups and based on the group, assign the value and pass it to the next page (no input from the user, all done behind the scene and user is redirected to PageB).
    On the next page I read that value and would like to send it to the SharePoint List Filter Web as a default value, as well as send it to another web part that displays the list from SQL, filtered using that default value. Ideally, if the user is from Group
    A, I'd like for them to have only one value in that drop down list; if user is from Group B - give him drop down list with 40 items to choose from. Below there is a part of the code and variable fnum has the value from PageA (if I print the value on the screen
    - I do see that it has correct value, so the code that gets groups from Active directory works correctly). If I assign fnum as a default value of the list, it shows "fnum" instead of the value of variable fnum. I connect to SQL database, using external
    content - so the other list that I'm filtering based on the value in that drop down list - is XSLT Data View Web part. I also have 2 more filters on that page, that user will have full access to and based on their input, it is also sent to the XSLT web part
    to filter out more data. Since one of the filters is the date and I am filtering data starting from the date that user chooses - XSLT is the only web part that I was able to make it work with.
    I looked at the link you provided (thank you). It is using Content Query Web part. Will it work with external content, as well as accepting multiple filtering, including custom starting date? I appreciate your help!
    <%
    string fnum = Request.QueryString["field1"];
    %><table cellpadding="4" cellspacing="0" border="0" style="height: 1000px">
    <tr>
    <td id="_invisibleIfEmpty" name="_invisibleIfEmpty" colspan="2" valign="top" style="height: 101px">
    <WebPartPages:WebPartZone runat="server" Title="loc:Header" ID="Header" FrameType="TitleBarOnly"><ZoneTemplate>
    <WpNs0:SpListFilterWebPart runat="server" FilterMainControlWidthPixels="0" RequireSelection="False" ExportMode="All" PartImageLarge="/_layouts/images/wp_Filter.gif" AllowHide="False" ShowEmptyValue="True" MissingAssembly="Cannot import this Web Part." AllowClose="False" ID="g_1ccc4bca_3ba1_480b_b726_adfdb1e9e02d" IsIncludedFilter="" DetailLink="" AllowRemove="False" HelpMode="Modeless" AllowEdit="True" ValueFieldGuid="fa564e0f-0c70-4ab9-b863-0177e6ddd247" IsIncluded="True" Description="Filter the contents of web parts by using a list of values from a Office SharePoint Server list." FrameState="Normal" Dir="Default" AllowZoneChange="True" AllowMinimize="False" DefaultValue="fnum" Title="Facilities List Filter" PartOrder="2" ViewGuid="2da5d8db-6b55-4403-80a8-111e42049f8b" FrameType="None" CatalogIconImageUrl="/_layouts/images/wp_Filter.gif" FilterName="Facilities List Filter" HelpLink="" PartImageSmall="/_layouts/images/wp_Filter.gif" AllowConnect="True" DescriptionFieldGuid="2d97730a-cd0d-4cb9-8b55-424951201081" ConnectionID="00000000-0000-0000-0000-000000000000" ExportControlledProperties="True" TitleIconImageUrl="/_layouts/images/wp_Filter.gif" ChromeType="None" SuppressWebPartChrome="False" IsVisible="True" ListUrl="/Lists/FacilitiesList" AllowMultipleSelections="False" ZoneID="Header" __MarkupType="vsattributemarkup" __WebPartId="{768E2035-0461-4A09-8DDD-CA7020C2B23D}" WebPart="true" Height="" Width="615px"></WpNs0:SpListFilterWebPart>
    Alla Sanders

Maybe you are looking for