Doubt in the analysis of String

Hello


'23:BE|2009:A@Banglore '.

I need to analyze the above string and retrieve the data.

Now I use the StringTokenizer and my code is present,

String sz = "23:BE|2009+A@Banglore";

          StringTokenizer szTkn = new StringTokenizer(sz, ":");

          System.out.println(" : " + szTkn.nextToken());

          szTkn = new StringTokenizer(szTkn.nextToken(), "|");
          System.out.println(" | " + szTkn.nextToken());

          szTkn = new StringTokenizer(szTkn.nextToken(), "+");
          System.out.println(" + " + szTkn.nextToken());

          szTkn = new StringTokenizer(szTkn.nextToken(), "@");
          System.out.println(" @ " + szTkn.nextToken());

          System.out.println(" " + szTkn.nextToken());
is there a good way to do this?

Vijay wrote:
You can use backreferencing to capture any group in a correspondence of motifs.
Take a look at this:
http://download.Oracle.com/javase/tutorial/essential/regex/groups.html

I don't see how "backreferencing' entry in this since the OP needs the content of field values between the separators without direct reference to what was found before.

Since the original code fields are always there, and always in the same order, I think it is always more easy just use split()

String sz = "23:BE|2009+A@Banglore";
String[] splitSz = sz.split("[:|+@]");

Tags: Java

Similar Questions

  • the analysis of string data

    Hi all

    I got the series communation data string in this format:

    Bridge of fuse HtrPwrV VDispV/C PAO V/C DTM V/C DiffC NC
    OK VALIDATES 1.80 0.95 3.16 0.53 537 29.6
    369 647 110

    And I want to extract some value from it. I realized that they are separated with spaces between them. So I thought about transfer them into an array and then extract some lines/columns there. But I don't know how to do.

    Could you give me an idea. Or if you have a better way, then please show me!

    Thank you

    Here is a way.

  • The analysis of string in the input channels

    Hello

    I'm trying to parse a string into a matrix, or tables in real time. Thus, assuming that the line below is part of my entry

    A134B932C321D95E532F1024A13B932C321D95E532F1024

    I would like to analyze the data and constantly create a matrix (or a series of paintings), such that each row corresponds to a letter. For example, something like below:

    13 13

    932 932

    321 321

    95 95

    532 532

    1024 1024

    I was able to parse the string using the letters as delimiters, but I was not able to find a way to organize the values. The goal of my project is to receive 6 different a mircoprocessor input and displaying the entries on different graphics.

    Thank you in advance,


  • The analysis of string to xml format

    Dear all,

    I have an OSB service that returns an xml string output form.
    I call this OSB service in BPEL but it fails because of the format of the string received by BPEL.

    How can I avoid it. I also try to convert string to xml but failing to do so.

    The pointers to that would be useful

    Thank you and best regards,
    MITS

    try to set the response from transport HTTP header
    http:content-type=text/XML
    application/xml or (even better)

    (and of course, you must make sure you have fn - bea: inlinedXml() function to convert the string in an XmlObject)

  • The analysis of string values

    Hello. I have a variable:

    var myString:String = "811 812";

    I want to be able to do is to have a code that crosses myString and analyzes the numbers between the commas. This value then is passed to my switch function where I assign methods based on the results.

    As I am new to AS3.0, I don't know where to start.

    Thanks for any help.

    -Of

    var myString:String = "811 812";

    var re: RegExp = /, /;
    Table of results: var = myString.split (re);

    trace(result[0]); 811
    trace(result[1]); 812

  • the analysis of string separated by commas

    Hello people,

    Indeed, this forum is great and has always helped me a lot. I hope that this time remains the same. Thank you guys for you continues a support and help.

    I have a value string as a-, b, c, d, e, f

    Just sql help, I want to put each value of the string above in a different line. If the output should be-

    one
    b
    c
    d
    e
    f

    using procedures would not only complex, but I just want to do by using queries.

    Please advise,
    Thank you.
    SQL> with t as (select 'ABC,DEF GHI,JKL' str from dual)
      2  select regexp_substr(str,'[^,]+', 1, level) list
      3  from t connect by level <= NVL( LENGTH( REGEXP_REPLACE( str, '[^,]+', NULL ) ), 0 ) + 1
      4  /
    
    LIST
    ---------------
    ABC
    DEF GHI
    JKL
    
  • Need to help in the analysis of string in JSON using PLJSON

    Hello
    I have JSON stored in a database field:

    -Query
    Select data1 from table1 where id = 339207152427;
    -Results:
    [{'name': 'Home'}, {'code': 'JPNWC74ZKW9'}, {'start date': ' 01\/02\/2014'}, {'name': "hhh, Rams '}]

    I need to analyze the above results in 3 fields in a separate table. For now, I just try to analyze the results using PLJSON, but get ORA-20101: JSON Parser exception - no {beginning found error during the execution of the following pl/sql block:}

    declare

    VIN_JSON varchar2 (4000);
    jsonObj json;
    listOfValues json_list;
    listElement json_value;

    Start

    Select data1 in VIN_JSON from table1 where id = 339207152427;

    jsonObj: = new json (VIN_JSON);
    listOfValues: = jsonObj.get_values ();

    I'm looping 1.listOfValues.count
    listElement: = listOfValues.get (i);

    end loop;
    end;
    /

    I believe that my syntax is close, but was hoping some new instructions.

    Thanks in advance!
    John

    The brackets indicate a list. If you already have a list and new json may not work.

    listOfValues := json_list(VIN_JSON);
    

    Published by: chris227 on 25.02.2013 12:52

  • The analysis of the non-numeric characters in a string

    Hello

    I am communicating a robot to LabVIEW (2013) via TCP/IP and sockets. The robot is the server, and LV is the customer.

    I start with the target data in this format (in a string):

    "[0 ~ 100 ~ 0] ~ [0.96593 ~-0.25882 ~ 0 ~ 0] ~ [1 ~ 0 ~ 0 ~ 0] ~ [150 ~ 50]."

    [X, Y, Z], [Q1, Q2, Q3, Q4], [C1, C4, C6, Cx], [TCPVel, OrientVel] except replacement ',' (comma) with a ' ~ ' (tilde) because I load the target data in a spreadsheet which is a comma-delimited file.

    In LV, I take this string, the analysis of the chain and split individual items. I then pulled the singular elements as unique, 32-bit of real numbers. I take each one and convert them individually to a string, concatenate them and send them to the robot. The robot decompresses these raw bytes individually and converts them to a target of robot (position in space).

    I train (BT) check if the user has sent a bad character (non-digital) in the target data. Example of this is:

    [- 50 ~-150 ~ 0] ~ [0.96593 ~-0 ] [B2has5D882 ~ 0 ~ 0] ~ [1 ~-1 ~ 0 ~ 0] ~ [150 ~ 50]

    Now in BT, when I'm scanning the chain, these bad character becomes the entire element to zero and everything else then to zero as well. See attachment for example screen similar.

    My question is, my VI, I can analyze all non-numeric characters (that are inside the parentheses and characters that are NOT a ' ~ ' (tilde))? In this way, I can always get this item numbers and do not have this element or other items turn to zero?

    Thanks in advance for any help!

    Sorry for the question of the test

    SM


  • The analysis of the data of a string of series

    Alert LabVIEW Express 7

    Sorry, all I have to work with and there is no budget at the moment to upgrade.

    Hello, I am in phase 1 (data transfer reliable to labview) 24/7 of my small Miettinen, who is to display and record data environmental Lab 24/7 our Fisher 02-403 digital barometer that has a serial port. In fact, it came with the software, but no one here seems to like use it so I'll try to find something more intuitive. I can't find any info at all about I/O with this device, so I'm reverse engineering. I'm sure that you cannot write anything to this device only read.

    I started with the connection of the device and the interface with NOR measure and automation and received the following string: P,43,1019,44,31,01,0023.0\r\n.

    I tried to use the Labview 7 Express e/s Companion Instrument, selected 1 COMM, changed the timeout to 5000 (trial and error), added a step reading and analysis, ran and received the following string: P, 43,0999, 44,41, 01,0018.0, XX. After well guess, I determined that the values I have in bold change with the environment and the other 3 are always the same idea 9no what they represent). Alphabetical 1 in bold represents the tendency of climate S sunny = P = C sunny cloudy = etc., the value 2 is the atmospheric pressure in hPa, the 3rd is % relative humidity and the last is the temperature in Deg. C.

    At first, I tried to create simply chips for data I want and operation loop the wizard of e/s in awhile, but often error messages obtained suggesting that I need to define all the tokens in the string. I did it and it worked, then I opened the front panel to access the underlying schemas whence I came with the attached VI. I left this race for more than 24 hours, no error, seems good.

    My question on this forum is, can I simplify this VI losing a part of the analysis of the data that I don't need at this point?

    Please let me know if you can not access this VI maybe I can do a screenshot or something.

    Thank you

    Doug

    Yes, it can be simplified to just a bit.

    Since you are new to LabVIEW, you can start with the basic tutorial.

  • Scan of the float double string %d - WHAT?

    I realize, I have problems using 'analysis of the chain' with %d as string formatting and him giving a double as the default type, but I certainly didn't expect this result.  3013981218 is not equal-1280986078.

    Looks like a bug to me (LV2011SP1-LV2015). Can someone explain this?

    When I say that the value that comes out the cast is planned, I mean I can expect something strange.

    What I didn't expect was this analysis a string whole duplicate using %d would give me the same result as the strange cataloged.

    OK, this is I32.  This is the message that I was thinking about: http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Upgrade-format-string-s-quot-d-quot-behavior-to-serve-...

  • doubt to the wi - fi connection

    Hello

    I have a doubt about the WiFi with a device.  I have this in my source code:

       String URL = urlupdate + ";interface=wifi";
                           conn = (HttpConnection)Connector.open(URL);
                           //
                          int rc = conn.getResponseCode();
                           if (rc != HttpConnection.HTTP_OK)
                               throw new IOException("Error response code: " + rc);
                           is = conn.openInputStream();
    

    and his works in my Simulator. But the doubt is when I use the phone, do I have to change the source code with all the settings?

    Thank you

    Assuming that the device has WiFi and it works, so this code should run as is, on the device.

  • The analysis of lists in PL/JSON

    I'm working on parsing a json string that is stored in a CLOB table in oracle 11g. This process belongs to a long analysis of routine which analyzes the data and stores the values in another table, and I just noticed that part of my data is not out. The json analysis and valid with JSONLint. So I simplified the analysis to try to find out where I'm wrong.

    So my json out of my table looks like this.

    {

    'JSON_data': {}

    "plant_id": "3006."

    "transmit_time": "2015-12-18 11:57:45."

    'messages': [{}

    'work_msg': {}

    "msg_time": "2015-06-23 04:54:17", ".

    "trigger_type':"interval. "

    'vert_correction': 358,3,

    'ch_latitude': 37.916302,

    'ch_longitude':-87.487365,

    'ch_heading': 212,3,.

    'ch_cable_port': 1029.79,

    'ch_cable_stbd': 348.63,.

    'ch_depth':-27.03,

    'slurry_velocity': 25.71,.

    'slurry_density': 1.02,.

    'ch_rpm': 205.49,.

    'ch_psi': 540.89.

    'prod_instantaneous': 0,

    'prod_cumulative': 1216.100000,

    'outfall_latitude': 37.915967,

    'outfall_longitude':-87.484369,

    'outfall_heading': 120,7,.

    "pump_entries": [{}

    'pump_name': 'main ',.

    'empty': 12.73.

    'outlet_psi': 22,88

    }],

    "spud_entries": [{}

    'position': 6

    }]

    },

    'pipe_length_event': {}

    "msg_time": "2015-06-23 04:54:17", ".

    "length_floating": 970

    }

    }]

    }

    }

    My analysis is properly find and do his thing with the data "work_msg". It's the data 'pipe_length_event' that I don't get to. Here is my pl/sql procedure.

    DECLARE

    vCONTENT CLOB.
    v_parent_json json;
    v_json_message_list json_list;
    v_json_message_list_value json_value;
    v_parent_json_value json_value;

    BEGIN

    SELECT CONTENT IN SJM_TEMP4 vCONTENT;

    v_parent_json: = json (vCONTENT);
    v_parent_json: = json (v_parent_json.get (1));

    v_json_message_list: = json_list (v_parent_json.get ('messages'));

    DBMS_OUTPUT. Put_line (v_json_message_list. (Count);

    for message_loop_counter in 1... loop v_json_message_list. Count
    v_parent_json_value: = json (v_json_message_list.get (message_loop_counter)) .get (1);

    If v_parent_json_value.mapname = "work_msg" then
    DBMS_OUTPUT. Put_line ('FOUND: work_msg');
    on the other
    DBMS_OUTPUT. Put_line (v_parent_json_value.mapname);
    end if;

    END LOOP;

    END;

    My dbms_output first gives me a sublist from 1 account. 2. not so my analysis does not yet recognize the 'pipe_length_event' as a sublist of "messages".

    How can I get data 'pipe_length_event' by using this procedure? I am almost sure that it worked in the past, so my first thought is that json is formatted differently. Is the json in the wrong format?

    Thanks in advance.

    They moved their forums to StackOverflow.  I had posted my question there before here.  In any case, I found my own answer.  JSON is not properly formatted.  The 'work_msg' was not closed correctly, and "pipe_length_event" has not been opened in a new list.  So once I had that all squared away he analysed very well.

    For reference, the correct formatting is below.

    {

    'JSON_data': {}

    "plant_id": "3006."

    "transmit_time": "2015-12-18 11:57:45."

    'messages': [{}

    'work_msg': {}

    "msg_time": "2015-06-23 04:54:17", ".

    "trigger_type':"interval. "

    'vert_correction': 358,3,

    'ch_latitude': 37.916302,

    'ch_longitude':-87.487365,

    'ch_heading': 212,3,.

    'ch_cable_port': 1029.79,

    'ch_cable_stbd': 348.63,.

    'ch_depth':-27.03,

    'slurry_velocity': 25.71,.

    'slurry_density': 1.02,.

    'ch_rpm': 205.49,.

    'ch_psi': 540.89.

    'prod_instantaneous': 0,

    'prod_cumulative': 1216.100000,

    'outfall_latitude': 37.915967,

    'outfall_longitude':-87.484369,

    'outfall_heading': 120,7,.

    "pump_entries": [{}

    'pump_name': 'main ',.

    'empty': 12.73.

    'outlet_psi': 22,88

    }],

    "spud_entries": [{}

    'position': 6

    }]

    }

    }, {

    'pipe_length_event': {}

    "msg_time": "2015-06-23 04:54:17", ".

    "length_floating": 970

    }

    }]

    }

    }

  • What is the url connection string hive in BDD 1.1?

    In my project, I need get data from the server to the hive. Test the jdbc connection to the hive by using the hive good username and password, but it fails and shows "cannot establish a connection."

    my connection url string is as jdbc:hive: / /myservername: 10000 / default

    I also test the other string of cloudera pilot of hive (jdbc:hive2: / / host : port / db_name ) and change the connection to jdbc:hive2: / /myservername: 10000 / default

    There too.

    Before establish us a connection, it must provide a dirver as name

    driverName = "org.apache.hadoop.hive.jdbc.HiveDriver"

    What is the url connection string hive in BDD 1.1? and which driver hive should be used?

    In the BDD 1.1, data in a table of hive are usually indexed and analysed when triggered via BDD provided - data processing interfaces the CLI data processing is run manually, or that is triggered by a cron job.  In this case, it is unnecessary to set up a specific JDBC connection to the table of the hive - BDD can index directly.

    The details above, I think you are saying that the table of the hive is in a different instance of the hive, in a cluster of Hadoop BDD is not installed, so the BDD data processing cannot run in the ordinary way, you want to read JDBC.  Is this correct?

    I think that BDD is struggling to load the hive JDBC driver - BDD 1.1 only DB Oracle and MySQL are supported for JDBC support.

    Is there something stopping you to reproduce the table of the hive in the environment where you have installed the BDD?  BDD can then process the table normally.

  • Regex help - the analysis of names

    I get the names of another system, and I need assistance, the analysis of the data that it is. There are errors of common input of the other system I want to correct that data are imported. I am formulating a regular expression to find and replace the common mistakes.

    Example 1: A folder with the family name "DE ROSA" is imported. Note that there are two spaces between "FROM" and "ROSA". I want to delete extra spaces. This one is more simple.

    Example 2: A file with the family name "DE ROSA - LA CRUZ" is imported. It's the same problem, but now there are two places where it should be fixed.

    Example 3: A folder with the name "LYNDE - ROSA" is imported. I would like to correct extra spaces in "DE ROSA", but not touch Lynde, which also contains 'FROM' at the end.

    I can't create a regular expression that finds all the scenarios that I need without including the results I want. These are the rules, I need:

    1. find the expression 'FROM' as a phrase with one or more spaces after him.
    2. the item preceding the "OF" must be nothing (the beginning of the line) or a character that is not a - z or A - Z.

    It sounds simple enough, but my expression either don't get "FROM" at the beginning of the string, or they catch the 'OF' at the end of a family name. The names are converted to uppercase simplified procession.

    Any help would be greatly appreciated. I tried to explain this with the simplest possible examples, but I can provide more information if it would help.

    You seem to need "negative look behind" are looking for which is not an alpha. Check the Javadoc for model.

  • looking for someone to help me with this problem. "It is no set application to open the document"stream_000b.strings ". "How can I get rid of him. pls help

    I get this message when I turn my macbook pro on "there is no set of application to open the document"stream_000b.strings ". "How can I get rid of him. pls help

    Check preferences system/users and groups to see if this item is in your login items. If so, select it and use the sign less to remove.

    If she is not there, see if you can find the file by using one of these programs. If you go Finder/display/show bar path, it will show you where it is located. You can then remove it.

    EasyFind-replacement of Spotlight

    Find any file

Maybe you are looking for

  • When Firefire open a siren begins

    A continuous siren sounds each time Firefox opens This has happened Each time Firefox opened is yesterday

  • May have already been answered... but can't find it.

    I recently bought the view of 8 MB. That's what I did... Extract music from CDs with Windows Media Player.  Synchronization with the view. The music goes on ok. Then I removed the music on my computer (I don't want to keep it there). The next time I

  • Subfolders IMAP Hotmail is no longer download in Thunderbird

    I have three IMAP Hotmail accounts I can access via Thunderbird. Since yesterday, two of these accounts stopped download & sync subfolders that I created to manage clients, family and friends. All I have now are at the top level of Inbox and folder d

  • BlackBerry Smartphones No. Fm with vm-605?

    I can pair up, listen to music on the internal speaker, change the language but receive nothing pressing/holding the button fm or hold the + flight trying the freqs change?  Wanted to try to reset but the only thing that looks like a reset hole is un

  • Get blue screens often

    I bought my laptop in December, and since then, I had constant blue screens. Recently, they were not as often, but always puts me off.Two recent minidumps can be found here https://skydrive.live.com/redir?resid=DEC4BCD66D7BDCC9! 108 & authkey =! AByi