A method which prints out if a strings starts with a character or not

Below you can see what I have made :
public class StringZerleger {
public static void main(String args[]) throws Exception{
new StringZerleger().zerlegeString();
public void zerlegeString()
String s3 = "_a b c d";
String [] temp = null;
temp = s3.split(" ");
dump(temp);
public void istGueltigerBezeichner()
String s3 = String s3;
boolean b = s3.regionMatches( 1, "_", 1, 1 );
public void dump(String []s)
System.out.println("------------");
for (int i = 0 ; i < s.length ; i++)
System.out.println(s);
System.out.println("------------");
unfortunately it doesn't work as I want it to work.
Could someone help me please ?

Below you can see what I have made :
public class StringZerleger {
public static void main(String args[]) throws
Exception{
new StringZerleger().zerlegeString();
public void zerlegeString()
String s3 = "_a b c d";
String [] temp = null;
temp = s3.split(" ");
dump(temp);
public void istGueltigerBezeichner()
String s3 = String s3;
boolean b = s3.regionMatches( 1, "_", 1, 1 );
public void dump(String []s)
System.out.println("------------");
for (int i = 0 ; i < s.length ; i++)
System.out.println(s);
System.out.println("------------");
unfortunately it doesn't work as I want it to work.
Could someone help me please ?
It shouldn't even compile.
This method
public void istGueltigerBezeichner()
String s3 = String s3;
boolean b = s3.regionMatches( 1, "_", 1, 1 );
}1) is never called,
2) should return a boolean
3) should accept the string you are testing as a parameter
4) should be redone using a different method of String
private boolean istGueltigerBezeichner(String str)
if(str == null)
    return false;
return "_".equals(str.substring(0,1));
}Then call this method from with you loop, before your println statement
~Tim
Message was edited by:
SomeoneElse

Similar Messages

  • Must I print out a new Alignment Page with each new cartridge?

    Do I need to print out a new Alignment Page with each new cartridge I install on my HP Photosmart C4480?  Or can I save and reuse the initial one I got when first installing my printer cartridges?  The Alignment pages all seem to be identical   when I print them out with each new cartridge I install, but I'm not examining them with a microscope.
    If I can save and reuse the Alignment page with sucessive cartridge replacements, when I am following the procedure for installing a new cartridge and the printer prompts me to print out a new Alignment page, is there an option to skip that step?  I don't recall seeing that option on the control panel window on the printer.
    Thank you!
    This question was solved.
    View Solution.

    themadtoker wrote:
    do NOT listen to this expert.
    YOU DO NOT NEED A NEW ALIGNMENT PAGE EVERY TIME YOU INSTALL A NEW CARTRIDGE
    I registered just to respond to this
    The alignment pages all look the same because they are all the same, pretty sure its a scam to let you use ink.  [snip]
    I am pretty sure you do not understand what the alignment page is for - it provides information for alignment of black vs. color and also is used to calibrate the operating energy for the color cartridge.
    You may be able to "fool" the printer by reusing an old alignment page, but the quality will suffer as you will not be running at the optimum energy.  
    You are certainly free to do what you want with your printer but please do not mislead others with misinformation.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • I cannot print out a webpage when viewed with firefox. I've removed and reloaded firefox. Same issue.

    I cannot print out a webpage when viewed with firefox. I've removed and reloaded firefox. Same issue. Printer program drop down indicates printer is offline. I bring up the same page with IE and no problem. Prints out no problem.

    Try the '''''reset''''' described here: <br />
    http://kb.mozillazine.org/Problems_printing_web_pages#Reset_printer

  • Find Whether String Contain Sequence Of Character Or Not

    <b>
    hello friend,
    I am to the new java. I need to findout whether the string contain sequence of character or not. I tried like this
    personLastName.length()> 0
    It will return true even my string contains space. Is there any other method in java to find out ?
    Thanks

    There are a few ways to do that. Check out the String class or Regex for one that suits but
    myString.indexOf(whatIWantToFindString)is an old favorite. It returns -1 if the sequence is not there, or the starting index if it is. The javadocs are your friends.
    regards

  • How to test if String starts with a Range of numbers

    Hello,
    I'm reading in a line from a text file and I want to see if that line starts with numbers.
    I know there is
    String temp = file.readline();
    if (String temp.startsWith(?1-9?); // want to check if string starts with 1 thru 9
    Thanks!

    Try the following:
    String temp = file.readline();
    if (temp.equals("1") || temp.equals("2")....... || temp.equals("9") {
    System.out.println("String is beetween 1 - 9");
    else{
    System.out.println("String is not beetween 1 - 9");
    Replace the "....." by the other values... I know it's quite long, but it should work... must be an easier way though...
    Pierre

  • Regular expression matches string starts with &

    Hello,
    I am trying to write a Reg Exp that removes any string starts with "&" and Ends with ";" . In other words, I am trying to remove anything similar to:
    & nbsp;  & quot; & lt; & gt;  Any help please.
    This does not work:
    select regexp_replace(ename, '^&[a-z]{2,4}[;]$') from emp;Regards,
    Fateh

    Fateh wrote:
    I am trying to write a Reg Exp that removes any string starts with "&" and Ends with ";" . In other words, I am trying to remove anything similar to:
    & nbsp;  & quot; & lt; & gt; 
    Those are entity references (without the whitespace after '&').
    Do you really want to remove them, or do you actually want to convert them back to their corresponding characters but don't know how to do it?
    SQL> set scan off
    SQL> select utl_i18n.unescape_reference('&#38;quot;Test&#38;quot;:&#38;nbsp;3&#38;gt;2') from dual;
    UTL_I18N.UNESCAPE_REFERENCE('&
    "Test": 3>2

  • String "starts with" function in ABAP

    Hi!
    I need to check in ABAP, if a given profit center (char 10) starts with P172. It could be filled with zeros -> 0000P17255. So I need to perform 2 actions:
    1)
    Lefttrim the 0 -> Result: P17255.
    2)
    Check, if the string starts with P172.
    How can I do this in ABAP?
    Thanks,
    Konrad

    Hi,
    You can do as below :
    1st scenario :
    loop at itab.
    "Below code will delete leading zero.
    SHIFT itab-prctr LEFT DELETING LEADING '0'.
    "Second scenario
    if itab-prctr(4) = 'P1972'.
    "Do necessary coding as per your requirment.
    endif.
    "If you wnat chnage tje contensts of the itab you can use modify else you append to append to another internal table.
    endloop.
    Thanks,
    Sriram POnna

  • Printing out double quote string

    Hello,
    I would like to know how can i print out the double quote string (")
    in JSP using out.print(), because a double qoute has already used
    for indicating the string. If the string that i want to print out is including double quote("), how can i print that string out.
    THX !

    out.println("\"mystring\"");
    generally: backslash "\" is used in Java to quote special characters e.g. out.println("c:\\my documents\\bla");

  • Hello, I would like to download my contacts from icloud to a flash drive in order to print out.  Can anyone help with this?  Many thanks

    Hello, I would like to download my contacts from icloud to a flash drive in order to have them printed out as I have over 4,000 contacts.  Could anyone help with this?  Thank you

    This  this discussion >  https://discussions.apple.com/message/24150181#24150181

  • My photos no longer print out in good quality since the latest iPhoto update to 9.5.1. This is happening with photos that have previously printed out at a large size with no problem.

    Since the upgrade to the latest version of iPhoto the photos no longer print in good quality. They appear crisp and in good focus on the monitor, then when they go to the page where they get edited and printed from, they go blurry. This is happening with photos hat I have previously printed out in large format ith no problems. I have looked at Preferencces but don't see anything about setting photo quality. Any ideas??

    At that size all you're getting is about 100-120 dpi. 300 dpi is considered most desireable for prints. Do you have a 4x6 print of the same photo made before you upgraded to 9.5.1 and Mavericks to compare with?
    OT

  • How to print out document list items (and with all comments!)

    Hi all,
    I am wondering how to get a good printout of document lists.
    In a web application I have some document list items and the users are adding many comments in it, so that the document list item doenst show all in the initial view, but scroll buttons to navigate up and down.
    I was surprised to read that the standard print functionality doesnt support document items.
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/43/68ce8391886e47e10000000a422035/content.htm
    How can I print out a list of all document list items with all comments?
    Ist there a workaround?
    thanks in advance for sharing your experiences, br, Michael

    Thanks guys for trying to help me...
    Gabriel, I not wanna do "a lot of trix" to get this out of iCal when it should be solved by iCal (from my point of view).
    Dancing Brook, Yes I hope we will see that in the future. I am convinced that there is many of us out there who want to see that function in iCal, even if they not really missed it yet.
    I have already sent a request to iCal feedback (hope they noted). Maybe they will if we are many doing so...

  • Extracting a  a piece of string starting with a number

    Hi,
    I am new to SQL, so I could use some help with the following issue. I need to extract contract number from a string, but the position of the contract number and the text inside of the string might vary, which means it is important to tie the SELECT statement to the number. Extracting only numbers wouldn't help too, because contract number contains letters and other characters. For example, if there was a string "Payment to a contract nr 1100/70HE", the SELECT statement should be able to extract only "1100/70HE" from that string.
    Thank you in advance,
    Keit

    Hi,
    welcome to the forum.
    Please read SQL and PL/SQL FAQ
    When you put some code or output please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    Coming to your question, I would say that extracting the contract number from a string it is not the ideal solution for a data model.
    Beside that, you may be able to reach your goal by using regular expression but you should provide more example and explain if the contract number could be identified with a specific pattern.
    I suggest you to post some sample data (CREATE TABLE and INSERT statement or a WITH statement) and try to identify a rule that can apply to extract your data.
    I.e.: if contract number always is one or more characters, followed by a slash (/) and followed by one or more characters then maybe you can use regular expression to identify it. I suggest you to post some cases and try to find the logic to apply.
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Oracle Text does not return results when String starts with two consecutive vowels

    Hi,
    I hope someone can shed some light on a strange problem we're facing.
    Oracle Database 11g R2 (11.2.0.4) EE 64-bit running on Windows 2008 Server R2.
    When I create a context index on a varchar2 column (surname) it works fine when the surname starts with either a consonant or one vowel. But when the surname starts with two vowels it fails to return the record?
    Please see worked example below:
    create table t1 (surname varchar2(50));
    insert into t1 values ('OURS');
    insert into t1 values ('JOURS');
    insert into t1 values ('ONES');
    commit;
    -- sync every 10 mins
    CREATE INDEX PERSON_SURNAME_IDX ON t1
    (SURNAME)
    INDEXTYPE IS CTXSYS.CONTEXT
    PARAMETERS('MEMORY 50M sync (every "SYSDATE+10/1440")')
    NOPARALLEL;
    -- no rows
    SELECT surname
    FROM t1
    WHERE CONTAINS(surname, 'OURS') > 0;
    -- 1 row
    SELECT surname
    FROM t1
    WHERE CONTAINS(surname, 'JOURS') > 0;
    -- 1 row
    SELECT surname
    FROM t1
    WHERE CONTAINS(surname, 'ONES') > 0;
    Any help or guidance greatly appreciated.
    Thanks,

    Wtf?
    https://docs.oracle.com/database/121/CCREF/astopsup.htm#i634475
    only     then     where
    all     do     into     onto     there     whether
    almost     does     is     or     therefore     which
    also     either     it     our     these     while
    although     for     its     ours
    select
    from v$version
    Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production    0
    PL/SQL Release 12.1.0.2.0 - Production
    CORE 12.1.0.2.0 Production
    TNS for Linux: Version 12.1.0.2.0 - Production
    NLSRTL Version 12.1.0.2.0 - Production
    SELECT spw_stoplist, spw_word FROM ctx_stopwords
    WHERE spw_stoplist ='DEFAULT_STOPLIST'
    order by nlssort(spw_word, 'NLS_SORT=LATIN')
    ---- snip ----
    DEFAULT_STOPLIST    not
    DEFAULT_STOPLIST    of
    DEFAULT_STOPLIST    on
    DEFAULT_STOPLIST    one
    DEFAULT_STOPLIST    only
    DEFAULT_STOPLIST    or
    DEFAULT_STOPLIST    other
    DEFAULT_STOPLIST    out
    DEFAULT_STOPLIST    over
    DEFAULT_STOPLIST    s
    ---- snip ----

  • AMT subsystem failure.  The licensing subsystem has failed catastrophically you must reinstall or call customer support.  Which never answers.  I have reinstalled with the same issues not sure whatelse to do?

    this message appear when I launch any program within the CS3 suite
    AMT subsystem failure.  The licensing subsystem has failed catastrophically you must reinstall or call customer support.  I call automated system which refers me to this site.  I have reinstalled with the same issues not sure what else to do?

    Try this Help article
    Error: "The licensing subsystem has failed catastrophically." when you start a Creative Suite 3.x application
    Nancy O.

  • Fmt:formatDate just prints out default Datetime String

    Hi,
    i am getting crazy here, because one can hardly do anything wrong here. This is my testcode:
    <jsp:useBean id="current" class="java.util.Date"/>
    <fmt:formatDate value="${current}" pattern="MMM"/>
    Pretty straightforward, but whatever i put in the pattern or even when using one of the predefined formats, i am allways getting the default String like:
    Wed Feb 23 21:16:31 CET 2005
    And no, its not a cache issue, the seconds were updated on every reload and i stopped tomcat a hundred times. Thanks for any info on this.
    Marc

    problems ? No
    Will you get the expected result ? Maybe , depends on what you expect to see.
    When using c:out then the var will be displayed as String so you will see the full length toString of a Date.
    If you want your own formatting you will need to use the fmt:FormatDate tag

Maybe you are looking for

  • Problem with cgicmd.dat in reports 10g

    Dear Sir/Mam, I've configured report serve on solaris 10. When executing reports using web url with key map given in cgicmd.dat file, I'm getting a very strange problem. Whatever parameters m passing to the reports through web url an additional "=" c

  • Logic Express 7.2 Installation on Intel Mac

    I've got the latest upgrades installed I think, and tried to install logic on a freshly reinstalled Mac, but always get this error: There was an error, try reinstalling Logic. (or something close to it). It happens during installation of Garage Band

  • Find all privileges

    Does anyone have a query I can use to display all of a user's privileges ? I have users that cannot drop tables, which I need to grant them, but when I run them "drop any table" privilege, they still cannot drop tables. I need a query that will displ

  • Marquee or lasso tool freeze Mac

    Hi, all, I am using PS CS4 Extended (11.0.1) on OS X 10.5.7, both patched to the latest update/security level. iMac white, 2 GB, NVIDIA 7600 GT. When I select the lasso or marquee tool or use the cropping tool and then mark an area in any picture (ev

  • Rename CD?

    Hi, I just copied my tax returns to a CD, but I named it incorrectly.  I'm trying to rename it by clicking on the CD title that is shown as it appears on my desktop (the same as I do with a regular file), but it won't shift to the mode that allows me