Multiple delimiters for StringTokenizer

If I am trying to parse a string which has multiple delimiters like
13:10_76.5
How do I tell the string tokenizer that : _ . (colon, underscore, period) are all delimiters? Or can I?
Thanks,
WF

Constructs a string tokenizer for the specified
string. The characters in the delim argument are
the delimiters for separating tokens.
Delimiter characters themselves will not be treated as
tokens.
[b]Parameters:
str - a string to be parsed.
delim - the delimiters[u].
Okay, I am new at this and perhaps I am missing something obvious, but if my string name is "inputstring''
this should look like this: public StringTokenizer(inputstring, :_.) ??
I am trying to parse out the stuff between these delimiters like in this example 13:10_78.5
If I want 13 then 10 then 78 then 5 pulled out, how do I get it to do that? Is that more clear??
Thanks for your patience!
Wf

Similar Messages

  • Parsing multiple delimiters

    I have to input and parse the contents of a .txt file. I can do this using Scanner class and defining a delimiter (e.g. scanner.useDelimiter(",");)
    However, my txt file has multiple delimiters. For example, this is a snippet of the file:
    Question: Question text goes here Location: Chicago, IL School: Unit 5 Grade: 8 Question: Question 2 text goes here Location: Inglewood, CA School: Ben Franklin Elementary Grade: 4
    So, basically, there are numerous delimiters (Question:, Location: School:, etc) and nothing that indicates the start of a new question. Note, I can't use : as a delimiter as it often appears in the text as a legitimate character
    Can someone inform me on the best way to parse using multiple delimiters so it reads:
    Question: Question Text
    Location: Chicago, IL
    School:
    Grade: 8
    Question: Question Text
    Location: Inglewood, CA
    School:
    Grade: 4
    thank you

    Or can use this code, but it has many limitations: the delimiters must start with uppercase (no other word must be uppercase)->instead of this you can use a regexp; also the result will contain all entries for the respective delimiter, delimited with ',' (comma), you can use other delimiter and then use that to split it if you want them separated.
    This is very poor quality code; any improvements and tips are more welcomed from experienced users
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    public class test
    public static void main(String[] args)
    try {
    BufferedReader br = new BufferedReader(new FileReader(new File("c:\\file.txt";)));
    String questions=processLine(br.readLine(), "Question:");
    System.out.println(questions);
    } catch (FileNotFoundException ex) {
    System.out.println(ex.getMessage());
    catch (IOException ex) {
    System.out.println(ex.getMessage());
    public static String processLine(String line, String delimiter)
    String processLine="";
    if(line.contains(delimiter))
    String delimiterIncrement=line;
    while(delimiterIncrement.contains(delimiter))
    int pos=delimiterIncrement.indexOf(delimiter);
    if(pos!=-1)
    int end=getFirstUpper(delimiterIncrement);
    if(pos>end)
    delimiterIncrement=delimiterIncrement.substring(pos);
    end=getFirstUpper(delimiterIncrement);
    processLine=processLine+delimiterIncrement.substring(delimiter.length()+1, end)+",";
    delimiterIncrement=delimiterIncrement.substring(end+1);
    else
    processLine=processLine+delimiterIncrement.substring(pos+delimiter.length()+1, end)+",";
    delimiterIncrement=delimiterIncrement.substring(end+1);
    else
    break;
    return processLine;
    public static int getFirstUpper(String myString)
    int first=1000000;
    myString=myString.substring(1);
    for(char c:myString.toCharArray())
    if(Character.isUpperCase(c))
    first=myString.indexOf(c);
    break;
    return first;
    }Or... you can use StringTokenizer as instructed on the other forum :))) That's the advantage of Java: knowledge of already built-in classes that improve and ease your work...
    edit: so this code does exactly what you want (printout) you must first adapt it to your specific needs... but hopefully helps a bit...
    Edited by: don1983p on Apr 19, 2009 12:11 AM

  • Flat File Destination Multiple Delimiters

    Hi Guys,
    This might been an easy one for you. I need to find out if the data from a table can be loaded into a text file with multiple delimiters or not using SSIS? For example, if I have 2 columns of data from a table,
    ID Name
    100 Mark
    I need to load this into a flat file and the output should be like this
    100,@Mark
    So basically, I need to have 2 delimiters in the flat file destination namely "," and "@". How can this be done.
    Thanks in advance.

    Can't you just fill in two delimiters in the Column Delimiter field of the Flat File Connection Manager (never tried it)?
    Alternatives:
    -In the source query add a @ to the second column: select column1,
    '@' + column2 as column2 from yourTable
    -Add a Derived Column with an expression that adds a @ in front of column2: "@" + [column2]
    Please mark the post as answered if it answers your question | My SSIS Blog:
    http://microsoft-ssis.blogspot.com |
    Twitter

  • "**" to be delimiter!! not only "*" what can I do!!???for StringTokenizer

    In my work
    If I have an equation, a+b**c+d*e
    ** means exponent. so b^c (but I should do that way **)
    there are 5different operators ---> ** + - / *
    so...I'm trying to use StringTokenizer.
    such that,
    StringTokenizer st = new StringTokenizer(String, "*/+-", true)
    even if I make (String,"*/+-**", true) ,it does not work.
    Is there any way I can do that??
    please somebody help me....

    As the StringTokenizer API doc says: All characters in the delim argument are the delimiters for separating tokens
    In other words, only single characters are used as separators.
    You might consider using Pattern and Matcher.
    For example:        String input = "a+b**c+d*e";
            Pattern pattern = Pattern.compile("[+\\-/]|\\*{1,2}|\\w+");
            Matcher matcher = pattern.matcher(input);
            while(matcher.find()) {
                System.out.println(matcher.group());
            }

  • Read from spreadsheet file with multiple delimiters

    Is there a way to specify multiple delimitors in the read from spreadsheet file vi? I have a file that i need to read in that contains both space and comma delimitors and would like to read that data into an array using both delimitors (or not and). Below is the data I'm trying to read.
    ;attenuator data table
    att00:   db       000h,015h,017h,035h,03Ch,03Eh,03Eh,05Ch,05Eh,05Eh
    att10:   db       07Ch,07Eh,07Fh,09Dh,09Fh,09Fh,0BDh,015h,017h,035h
    att20:   db       03Eh,03Eh,05Ch,05Ch,05Eh,07Ch,07Ch,07Eh,09Dh,09Dh
    att30:   db       09Fh,0BDh,000h,000h,000h,002h,002h,002h,002h,003h
    att40:   db       021h,021h,021h,021h,021h,023h,023h,023h,023h,023h
    att50:   db       041h,041h,048h,048h,048h,04Ah,04Ah,04Ah,04Ah,068h
    att60:   db       068h,068h,068h,068h,068h,06Ah,06Bh,06Bh,06Bh,089h
    att70:   db       089h,089h,089h,08Bh,08Bh,08Bh,08Bh,0A9h,0A9h,0A9h
    att80:   db       0A4h,0A6h,0A6h,0A6h,0A6h,0C4h,0C4h,0C4h,0C4h,0C6h
    att90:   db       0C6h,0C6h,0C6h,0E4h,0E4h,0E5h,0E5h,0E7h,0E7h,0E7h
        END
    I'm looking to just read in the data adjust the hex values and then save the data in the exact form which I read it in. If read from spreadsheet file can not recognize multiple delimiters that is all I need to know. I do not want to spend time reading it in using a single delimitor and doing a bunch of string manipulation. I'm also working with LabView 8.5 if that makes a difference.

    You should use "scan string for tokens", and wire an array of delimiters.
    One nice behavior is the fact that consecutive delimiters are contracted into one (by default), so e.g. if your delimiters is an array containing a space and a comma, a sequence of three spaces and a comma would still count as one delimiter.
    For some ideas, have a look at my old example here:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=192847#M192847
    LabVIEW Champion . Do more with less code and in less time .

  • How can multiple files for the same genre be consolidated

    I organize my iTunes files in genre folders for easy access. ITunes creates multiple folders for some genres and allows a single (preferred) genre file for other much larger files. How can I consolidate multiple files with the same genre?

    Thanks. I've done what you selected. The problem is that despite all files being identified with the same genre, iTunes groups some genres in two separate folders. Thus, I have two "Country" folders, for example. More perplexing is that iTunes groups my largest genre folder, "Jazz", in a single folder.

  • Not able to generate multiple lines for headers in report

    Hi,
    I am new to BI publisher and not able to generate multiple lines for headers. Please help me to resolve.
    I am using RTF template, data source as PS Query and XML file (system generated from the data source)
    When I am using system generated 'First XML' file, I am getting output in the follwoing format.
    TEAM_MEMBER, PROJECT_ID, NAME, START_DT
    e.g.
    EMP1 , 71000, Sample, 01-Jan-2010
    EMP1 , 72000, Sample, 01-Feb-2010
    EMP1 , 73000, Sample, 01-March-2010
    But I want the report to be generate with multiple projects for one employee like below format , for that I used 'Second XML' file but I am getting blank report.
    In short if there is one to many case, how to show in reports??? Please correct if I am going wrong.
    TEAM_MEMBER
    PROJECT_ID, NAME, START_DT
    PROJECT_ID, NAME, START_DT
    PROJECT_ID, NAME, START_DT
    e.g.
    EMP1
    71000, Sample, 01-Jan-2010
    72000, Sample, 01-Feb-2010
    73000, Sample, 01-March-2010
    **********First XML**************System generated XML ****************************
    <?xml version="1.0"?>
    <query numrows="2" queryname="SY_EMP_PROJECT" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="">
    <row rownumber="1">
    <TEAM_MEMBER>TEAM_MEMBER </TEAM_MEMBER>
    <PROJECT_ID>PROJECT_ID samp</PROJECT_ID>
    <NAME>NAME sample data</NAME>
    <START_DT>2010-08-25</START_DT>
    </row>
    <row rownumber="2">
    <TEAM_MEMBER>TEAM_MEMBER</TEAM_MEMBER>
    <PROJECT_ID>PROJECT_ID samp</PROJECT_ID>
    <NAME>NAME sample data</NAME>
    <START_DT>2010-08-25</START_DT>
    </row>
    </query>
    **********Second XML**************Manually created XML and using to show multiple projects for one employee****************
    <?xml version="1.0"?>
    <TEST numrows="2" queryname="SY_EMP_PROJECT" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="">
    <TEAM_MEMBER rownumber="1">
    <TEAM_MEMBER>1</TEAM_MEMBER>
    <EMPLOYEE_NAME>SAMPLE</EMPLOYEE_NAME>
    <PROJECT>
    <PROJECT_ID>1111</PROJECT_ID>
         <PROJECT_DESCR>SAMPLE</PROJECT_DESCR>
    <START_DATE>01012010</START_DATE>
    </PROJECT>
    <PROJECT>
    <PROJECT_ID>1112</PROJECT_ID>
         <PROJECT_DESCR>SAMPLE</PROJECT_DESCR>
    <START_DATE>01022010</START_DATE>
    </PROJECT>
    </TEAM_MEMBER>
    <TEAM_MEMBER rownumber="2">
    <TEAM_MEMBER>2</TEAM_MEMBER>
    <EMPLOYEE_NAME>SAMPLEC</EMPLOYEE_NAME>
    <PROJECT>
    <PROJECT_ID>1111</PROJECT_ID>
         <PROJECT_DESCR>SAMPLE</PROJECT_DESCR>
    <START_DATE>01012010</START_DATE>
    </PROJECT>
    <PROJECT>
    <PROJECT_ID>1112</PROJECT_ID>
         <PROJECT_DESCR>SAMPLE</PROJECT_DESCR>
    <START_DATE>01022010</START_DATE>
    </PROJECT>
    </TEAM_MEMBER>
    </TEST>
    Edited by: ganeshtw on Aug 25, 2010 12:14 AM

    Hi,
    With your first xml you can print like
    EMP1
    71000, Sample, 01-Jan-2010
    72000, Sample, 01-Feb-2010
    73000, Sample, 01-March-2010While creating the RTF template you can use the Group by option.
    <?for-each-group:ROW;./columnname> then print the column name
    <?columnname?>
    --Then your table format
    71000, Sample, 01-Jan-2010
    72000, Sample, 01-Feb-2010
    73000, Sample, 01-March-2010
    <?end for-each-group?>
    Thanks.

  • How to get one value from multiple duplication for a key figure field

    Hi expert,
          I have a infoprovider, with following format:
            employee     hourly_rate   action_type  count of action
         there are multiple rows for each employee, I want to create query as follows:
            employee     hourly_rate   action_type  count of action
         in which hourly_rate is constant , only retriving one value from multiple rows for one employee, count of action should be summarized. 
    how to get this hourly_rate.
    Many Thanks,

    Hi,
    put the employee in rows panel -> reaming object put it in free char panel.
    suppress the all result rows for the all object except employee .
    select the object -> go to query properties -> select display tab -> select result rows -> select suppress.
    select the employee -> go to query properties -> select display tab -> select result rows -> select always display. - now it will give employee wise hourly rate summarize data.
    Thanks,
    Phani.

  • Passing multiple values for a single field in URL to call sap Transaction

    Hi All,
    I need to pass multiple values for a single field to SAP transaction .
    means if i have say a field "Date" which can contain more than one value, <b>but its not a range which has two fields</b> . How is it possible.
    Let me know pls.
    Regards,
    Sirisha.R.S.

    Hi Satyajit,
    I need to call a transaction with multiple values which gives me the report based on those values.
    So I need to pass multiple values for a single parameter.
    I hope u got it.
    Regards,
    Sirisha.R.S.

  • Any way to pass Multiple Values for a single Label in the Parameter?

    I have a Report that Contains 2 Parameters, @Customer & @Area. When trying to set up the Available Values for @Area, I'm having issues using multiple values for one Label, i.e. = "4006" Or "4610"
    One of the Filters in the Report is an Operation number, which is the [OPERATION] field, which is setup as a filter on the Tablix referencing the @Area parameter. 
    PROBLEM: I cannot retrieve any data when trying to use the ‘Or’ Operator here. If I simply put “4006” or “4610” I retrieve data, but when trying to combine it returns no data.
    Example, I need to allow a user to select ‘Chassis Incoming’, which would include data from Operations 4006 & 4610.
    QUESTION:
    Any way to pass Multiple Values for a single Label in the Parameter?
    I realize the typical solution may be to use ‘Multi-Value’ selection, but in this case we want the User to select the Area and the multiple values for Filtering will be automatically determined for them. Otherwise, they are subject to not getting
    it correct.
    I have tried several different ways, such as =”4006” Or “4610”, =(“4006”, “4610”), = In(“4006”, “4610”), etc….
    Note: We are using Report Builder 3.0

    Based on my experience, there's no way to 'intercept' the query that gets passed back to SQL Server, so a Split wouldn't work.
    Try creating either a function or stored procedure using the code below (compliments to
    http://www.dotnetspider.com/resources/4680-Parse-comma-separated-string-SQL.aspx) to parse the string: 
    CREATE FUNCTION dbo.Parse(@Array VARCHAR(1000), @Separator VARCHAR(10))
    RETURNS @ResultTable TABLE (ParseValue VARCHAR(100))AS
    BEGIN
    DECLARE @SeparatorPosition INT
    DECLARE @ArrayValue VARCHAR(1000)
    SET @Array = @Array + @Separator
    WHILE PATINDEX('%' + @Separator + '%' , @Array) <> 0
    BEGIN
    SELECT @SeparatorPosition = PATINDEX('%' + @Separator + '%', @Array)
    SELECT @ArrayValue = LEFT(@Array, @SeparatorPosition - 1)
    INSERT @ResultTable VALUES (CAST(@ArrayValue AS VARCHAR))
    SELECT @Array = STUFF(@Array, 1, @SeparatorPosition, '')
    END
    RETURN
    END
    Once created you can do things like this:
    SELECT * FROM Parse('John,Bill,David,Thomas', ',')
    SELECT * FROM (SELECT 'John' AS TestName union select 'David' AS TestName) AS Main
    WHERE TestName IN (SELECT ParseValue FROM dbo.Parse('John,Bill,David,Thomas', ','))
    This is what your SQL query would probably look like:
    SELECT OperationID, OperationName FROM dbo.Operations
    WHERE AreaID IN (SELECT ParseValue FROM dbo.Parse(@Area, ','))
    You may need to fiddle around with the Separator depending on whether SQL Server inserts a space between the comma and next value.

  • How to print multiple footers for each page in RTF template xml report.

    Hi,
    How to print multiple footers for each page in RTF template xml report.
    i am able to print ( two sets ) ...
    up to last page ( one template ) and for last page ( another template).
    i want to change the footer information based on the group value printed in the report ( it might be 5 to 6) In every report run.. can you please check and let me know do we have any feasibility to achieve this.
    Thanks in advance.
    Regards,
    KAP.

    You can remove all other logic, like last page only contents (start@last-page:body), etc and section breaks if any you have inserted manually.
    Just have for-each@section logic.
    It would be difficult for me to guess what you have done without looking at your RTF or describing here.

  • I am using my Apple ID on multiple devices for other people. How can I make icloud work only for my devices?

    I am using my Apple ID on multiple devices for other people in my family and now I am getting a new iphone and want to take only the information on my old iphone to the new one without the information on the other devices using the same account. Is there a way to do that?
    Also, for the future can I use multiple addresses and apple IDs for the same credit card information?
    Thanks in advance,
    Marian

    Ok, so you want to remove data (contacts, bookmarks, calendar etc) from other users from your iCloud/Apple ID?
    If you want to use your ID for your family because it is the account everybody uses to buy stuff then you only need to ensure that your apple ID is set up in the store (settings-store) and then the users of each device and put their own apple ID in icloud/message/facetime/etc.
    To set up your device, in my opinion, it is best to back up to itunes, and then plug your new device into itunes and "set up as ..." and select the backup from your device.  This will import all your data/settings and your new device will be set up just like your old one.
    I am not certain about using the same payment method for more than one account. 

  • HT1495 Multiple ipads for classroom use how can I make them have the same apps?

    How do I sync multiple ipads for classroom use

    There is no bookmarks tab, expect you are referring to the bookmarks menu on the menu bar ("File, Edit, View, History, Bookmarks, Tools, Help") on your XP system.
    Once your restore your menus on you Window 7 system, you can get rid of the bookmarks button. After going through the 10 steps below your toolbars on your Windows 7 system will be more usable again and like your XP system, none of which has anything to do with Sync.
    You can make '''Firefox 6.0.1''' look like Firefox 3.6.*, see numbered '''items 1-10''' in the following topic [http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface Fix Firefox 4.0 toolbar user interface, problems (Make Firefox 4.0 thru 8.0, look like 3.6)]. ''Whether or not you make changes, you should be aware of what has changed and what you have to do to use changed or missing features.''
    * http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface
    the first 9 steps above are basic toolbar customization the following link is in step #1 above. (See before/after picture (.png) in the footnote)
    *How do I customize the toolbars? | How to | Firefox Help
    *:https://support.mozilla.com/en-US/kb/how-do-i-customize-toolbars
    <br><small>Please mark "Solved" one answer that will best help others with a similar problem -- hope this was it.</small>
    There is a lot more beyond those first 10 steps listed, if you want to make Firefox more functional.
    Before and after customizations, the following also includes [http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4styles styling changes] besides rearranging toolbars and toolbar items.
    * http://dmcritchie.mvps.org/icons/fx4toolbars.png
    *:Bookmarks toolbar -- [http://userstyles.org/styles/46947 Bookmarks Toolbar Fx4 Blue/Folders, Red/Bookmarks]
    *:Tab borders -- [http://userstyles.org/styles/24728 Tab Color Underscoring active/read/unread (Fx3.6)] red=active tab, blue=read, green=unread, magenta(not shown)=loading

  • How do I add multiple emails for one contact to the same group list?

    When trying to set up a group email list using address book, is there a way to include multiple emails for the same contact to one group.  For example I'm trying to set up a baseball team group email.  Some kids want emails sent to both mom and dad which have different emails.  I currently have them in my address book as the boy's name with the emails listed as mom and dad.  I can add one "mom" to the list but when I compose the email, it will use the most recent email used.  I would like the group to contain both addresses for mom and dad without setting up to different contacts for the same player.

    var cToAddr = this.getField("saManager").value + ";" + this.getField("ManagerEmail").value;

  • How can I manage multiple iPads for different students?

    Problem: I need to manage multiple iPads for my students with special needs. I need to download different apps to different iPads and I'm not sure how to keep their apps separate but still keep ultimate control of the units (i.e. lock them from loading anything on the apps that we at the school district haven't approved).
    I need to be the only one doing updates, loading software, etc., and don't want to keep using my own personal iTunes account...any suggestions?

    If the presenter is using a computer and everyone else has an iPad this is very easy and free. Just use http://join.me and on the iPad just download their free app

Maybe you are looking for

  • How can i log out from icloud without losing any document?

    I want to create a new icloud account, but first I need to delete the previous one without losing my documents.

  • Amend a FYI Notification

    Dear All, I hope that you can guide for this issue. We have a need to include Absence Details in our FYI Notifications for Absences. The Notification that we receive has no details and FYI Recipients do not have an insight of the Absence. We tried to

  • Track computer changes in a collection within a specified time period.

    I have a typical requirement where I need to find out list of computers that moved in and out of a query based Device Collection. The scenario: I have few collections, based on the OUs of Computers. Collection A lists all machines in OU A Collection

  • Font error with inputsource 2-set Korean

    When I type Korean font in certain 3rd party application such as Scrivener, font scatters and it doesn't build up correctly. As you might be aware, a letter of korean word is consist of vowels and consonants in one buid up For example, "king" is 킹 in

  • Keynote Crashes

    I use a looping Keynote for communications purposes here at work and I have it lopping 24 hours a day. The problem I am having is that the Keynote crashes if there is a QuickTime movie in the Keynote. The keynote runs fine all day long if there are n